-
Notifications
You must be signed in to change notification settings - Fork 6
Connections
WIKI Home -> Connection management
For any interaction with NKN, client has to connect to a node and depending on action either ask that node directly to do it (rpc actions) or negotiate new connection to different node (sending and receiving messages). We call this initial node a bootstrap node.
If you want to tell client to use different than default bootstrap node (for example you run your own local node or you just want to use different one(s) for load balancing or performance reasons) or adjust other network parameters like timeouts or reply count, you can do it by interacting with ConnectionProvider
Setting new bootstrap nodes:
ConnectionProvider.setBootstrapNodes(new String[] { new String("localhost:30003") });
Max retry count:
ConnectionProvider.maxRetries(5); // Default is 3
int currentMaxRetryCount = ConnectionProvider.maxRetries();
Node action timeout (rpc):
ConnectionProvider.rpcCallTimeoutMS(15000); // Default is 5000 ms
int currentRpcCallTimeoutMS = ConnectionProvider.rpcCallTimeoutMS();
Timeout between message sent and message reply/ack received:
ConnectionProvider.messageAckTimeoutMS(15000); // Default is 5000 ms
int currentMessageAckTimeoutMS = ConnectionProvider.messageAckTimeoutMS();
Timout between last message received message or ack in session mode, from any mutliclient:
ConnectionProvider.sessionTimeoutMS(15000); // Default is 10000 ms
int sessionTimeoutMS = ConnectionProvider.sessionTimeoutMS();
All actions in this class are thread safe
Beware: Both NKN nodes and this sdk are still work in progress and anything can change or stop working at any time.