Skip to content

Mqtt broker cannot authenticate for the second time #14

Open
@wzqallz

Description

@wzqallz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions