-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mqtt broker cannot authenticate for the second time #14
Comments
Hello Thanks, |
hello, 0|broker | BROKER(23) INFO: broker has been started on port: 1883 --- 2018-05-14T08:44:40.644Z |
At first sight the problem is in 0|broker | BROKER(23) DEBUG: client with id: "5CCF7FCCE3E1" has been authorized for publishing in to the topic: "dh/request" --- 2018-05-14T08:50:03.033Z it seems like you trying to publish message after closing connection (actually, it's not you, it's because of some bugs in internal broker functionality). As a temporary fix I would like to suggest adding a delay between publishing and closing connection ( 1-2 sec I think ). If it not help, please, inform me. I will try to fix it as soon as possible. Thanks, |
Yeah, I called the MQTT_InitLWT() function on the mqtt client. When I don't set last will, it works fine. |
I think that the mqtt broker sent the last will message to the devicehive server, websocket did not disconnect the reason. How do I modify the code? Do you have any suggestions? @itrambovetskyi |
MQTT broker is not able to send any LastWill message because it's a client side functionality. Also, I have found the source of that problem and almost fixed it. Wait a while and you will be able to use custom client id's without that problem. |
Thank you very much! |
@wzqallz Please, check the fix and inform me about the results. |
@itrambovetskyi [2018-05-16 01:58:56] PM2 log: Launching in no daemon mode
|
@wzqallz Unfortunately, the logs you provided are not informative to understand the behavior you have described. Also, I can't reproduce it on my side. Could you please provide me with information about what notification/commands are you sending/receiving, or maybe some code snippets... |
@itrambovetskyi sorry,I did not describe my problem clearly.
When I re-deploy the mqtt broker,repeat the above imagination again. |
hi,
mqtt broker Run with Docker.
I use esp8266 to connect to the mqtt broker. The mqtt client id uses the esp8266 mac address. The first time the connection was normal, when I disconnected the mqtt connection, I could not connect when I connected again. See docker logs information as shown below:
0|broker | BROKER(22) INFO: broker has been started on port: 1883 --- 2018-05-14T07:17:31.570Z
0|broker | CrossBrokerCommunicator > service.online CrossBrokerCommunicator#eebbf8cb-4ad7-4afa-87cd-4d0fe3b9e89e
0|broker | BROKER(22) DEBUG: client with id: "5CCF7FCCE3E1" has been authenticated --- 2018-05-14T07:18:31.376Z
0|broker | BROKER(22) INFO: client with id: "5CCF7FCCE3E1" connected --- 2018-05-14T07:18:31.396Z
0|broker | BROKER(22) DEBUG: client with id: "5CCF7FCCE3E1" has been subscribed for topic: "dh/command/2/9/5CCF7FCCE3E1/#" --- 2018-05-14T07:18:32.115Z
0|broker | BROKER(22) DEBUG: client with id: "5CCF7FCCE3E1" has been authorized for publishing in to the topic: "dh/request" --- 2018-05-14T07:20:18.572Z
0|broker | BROKER(22) INFO: client with id: "5CCF7FCCE3E1" disconnected --- 2018-05-14T07:20:18.582Z
0|broker | BROKER(22) DEBUG: client with id: "5CCF7FCCE3E1" has published to topic: "dh/request" --- 2018-05-14T07:20:18.596Z
0|broker | BROKER(22) WARN: client with id: "5CCF7FCCE3E1" has not been authenticated. Reason: Error: User with id 5CCF7FCCE3E1 already connected --- 2018-05-14T07:21:30.602Z
0|broker | BROKER(22) WARN: client with id: "5CCF7FCCE3E1" has not been authenticated. Reason: Error: User with id 5CCF7FCCE3E1 already connected --- 2018-05-14T07:21:36.615Z
0|broker | BROKER(22) WARN: client with id: "5CCF7FCCE3E1" has not been authenticated. Reason: Error: User with id 5CCF7FCCE3E1 already connected --- 2018-05-14T07:21:42.605Z
0|broker | BROKER(22) WARN: client with id: "5CCF7FCCE3E1" has not been authenticated. Reason: Error: User with id 5CCF7FCCE3E1 already connected --- 2018-05-14T07:21:48.600Z
Is this because the websocket is not disconnected? But I see there are disconnected websocket in the source code。
server.on(
clientDisconnected
, (client) => {wsManager.close(client.id);
appLogger.info(
client with id: "${client.id}" disconnected
);});
How do I fix this problem?
thank you
The text was updated successfully, but these errors were encountered: