"WebSocket is already in CLOSING or CLOSED state" on sending event before disconnecting
See original GitHub issueDo you want to request a feature or report a bug? bug
What is the current behavior?
Sending event right before pusher disconnect call leads to WebSocket is already in CLOSING or CLOSED state
error (and also no event sent).
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar.
pusherChannel.trigger('evenName', { field: 'value' });
pusher.disconnect();
// `WebSocket is already in CLOSING or CLOSED state.` in console no event sent
Looks like this deferred sending callback
https://github.com/pusher/pusher-js/blob/807b778463851f3a9b02114abf06f00f65e94d8f/src/core/transports/transport_connection.ts#L134
is invoked before onClose
call and socket cleanup
https://github.com/pusher/pusher-js/blob/807b778463851f3a9b02114abf06f00f65e94d8f/src/core/transports/transport_connection.ts#L165
but socket is already in closing state at that time
What is the expected behavior? Event has been sent, no error in console
Which versions of Pusher, and which browsers / OS are affected by this issue? Did this work in previous versions of Pusher? If so, which? pusher-js: 4.2.2., 5.0.3 Chrome 79
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5
Top GitHub Comments
😕
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you’d like this issue to stay open please leave a comment indicating how this issue is affecting you. Thank you.