JSteunou / webstomp-client

Stomp client over websocket for browsers
Apache License 2.0
299 stars 59 forks source link

Disconnect and reconnect issue #67

Open TimYi opened 6 years ago

TimYi commented 6 years ago

I read the source code to get a better knowledge of auto reconnect. I found that disconnect method sends a 'DISSCONNECT' frame and wait for a receipt before cleanup and close websocket. There may be chances that websocket onClose is invoked when doing disconnect, so I think a disconnecting flag should be added to handle this situation.

JSteunou commented 6 years ago

Thanks for the find out. Would you mind opening a PR on this one?

MorganTrench commented 5 years ago

I'm looking into a problem I'm encountering and I'm unsure if this is related.

I know WebSocket.send() closes the socket if the data cannot be sent (https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send), so I can see onClose being invoked before intended, but where/how does it "wait for a receipt" before cleanup?

JSteunou commented 5 years ago

You double posted your comment, I deleted the 2nd.

I'm sorry I do not clearly understand the last part of your question.