moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 513 forks source link

Client cannot recieve messages after rebuild connect #716

Open Samcasa opened 6 years ago

Samcasa commented 6 years ago

this bug not occur every times, about one in ten times, but it is upsetting when we cannot recieve messages. about client ,we are using paho.mqtt for android.

Bug description:

  1. build connection-->authorize-->subscription-->publish. the flow is normal.
  2. client lost the connection.(for example, the network is poor), the client will connect the server automatically. this have two different situation:
    • if the server log shows disconnect with client , clients will connect with server and then auth subscrition.and everything will be ok.
    • if the server log show nothing, the problem is here: some time clients could recieve message,some times couldnot, we have already excluded other factors like : 1. net speed . 2. interval time.

we have another socket to upload our face image data. the timeout set about 15s. but if the client lost connect ,the socket log in server shows disconnect immediately everytime.

so we ask if there any ways let the server disconnect immediately if lost connect with clients?

Thanks very much ,happy christmas.

mcollina commented 6 years ago

are you using a keepalive in the mqtt options? Are you using a keepalive at the TCP socket level?