Closed parkmeta closed 4 years ago
Should I manually manage the DataClient instance pool?
Yes.
Also, I think it's a good idea to add a callback as the last parameter to the DataClient.send() function. This callback will be passed as last parameter to this.mqtt.publish() to receive 'MQTT publish' result.
That could be useful indeed. Can you create a PR?
Okay, I will do as soon as possible.
Hi, Thank you for previous answer.
I have more questions.
Can I close(release) AppClient and DataClient? Or don't i need to close the clients?
After i get some TTN clients(AppClient and DataClient), i see below error message for a period of time. Is there a limit on the number of times I can connect to the Discovery server? Also, Is there a recommended time gap between connect and after connect?
14 UNAVAILABLE: Connect Failed
at Object.
.exports.createStatusError (node_modules/grpc/src/common.js:87:15) at Object.onReceiveStatus (node_modules/grpc/src/client_interceptors.js:1188:28) at InterceptingListener.Object. .InterceptingListener._callNext (node_modules/grpc/src/client_interceptors.js:564:42) at InterceptingListener.Object. .InterceptingListener.onReceiveStatus (node_modules/grpc/src/client_interceptors.js:614:8) at callback (node_modules/grpc/src/client_interceptors.js:841:24)
Thx.
Can I close(release) AppClient and DataClient? Or don't i need to close the clients?
You can close them, that probably releases underlying resources, which is a good idea for you and for us.
After i get some TTN clients(AppClient and DataClient), i see below error message for a period of time. Is there a limit on the number of times I can connect to the Discovery server? Also, Is there a recommended time gap between connect and after connect?
We have API throttling indeed. For normal use, this shouldn't become a problem. How many requests are you firing?
I create new client 5 times in 10 minutes, about 7 days I will try to manage client pool.
Hello.
I had a trouble because i create new DataClient instance each time I send downlink. From the sdk code, I noticed that every time I create a DataClient I get a new MQTT connection.
How do I use the DataClient correctly? Should I manually manage the DataClient instance pool?
Also, I think it's a good idea to add a callback as the last parameter to the DataClient.send() function. This callback will be passed as last parameter to this.mqtt.publish() to receive 'MQTT publish' result.
Please give me feedback.
Thx.