Open filmaj opened 2 months ago
This is a tricky issue to handle, because the 1.x line of socket-mode's architecture is such that there is a single state machine to handle transitions, but potentially, during a reconnect, two WebSocket connections are briefly active/overlapping as a connection is re-established. The underlying problem is, during this reconnect when we have two WS connections open, each WebSocket connection pumps events into the single state machine, causing unexpected state transitions.
Consider the case where, at more or less the same time, one WS connection sends a "disconnect" event to the state machine and another sends a "open" or "connected" event. The single state machine will get confused.
This issue is resolved in socket-mode 2.x, as the architecture has completely changed. Socket-mode 2.0 is available in bolt 4.0.0 rc1, and has been used successfully by some customers who have adopted it early.
With debug logging it shows:
Originally posted by @MadrMan in https://github.com/slackapi/node-slack-sdk/issues/1654#issuecomment-2094100237
Any PR to address this should target the
socket-mode-1.x
branch as this would be a 'maintenance' fix for the now-outdated 1.x line of socket-mode.