blackhorse-one / stomp_dart_client

Dart STOMP client for easy messaging interoperability.
BSD 3-Clause "New" or "Revised" License
59 stars 44 forks source link

Use different session and server IDs for new connections with SockJS #93

Closed daniel-naegele closed 1 year ago

daniel-naegele commented 1 year ago

Currently, the session and server IDs only get generated once - when the StompConfig is created. This can lead to the following issue:

  1. Connect to SockJS Server
  2. End connection without properly sending the DISCONNECT command (connection timing out or when #92 happens)
  3. Initiate connection again

Our SockJS implementation (Spring Boot) then ignores the connect frame, as it thinks that the client is still connected. This leads to the CONNECTED frame not being sent and thus StompConfig#onConnect() not being called. This can be an issue for subscribing to topics if onConnect has never been called so far.

Log output from our Spring Boot backend: 2023-09-07T14:33:41.561Z WARN 1 --- [boundChannel-64] o.s.m.s.b.SimpleBrokerMessageHandler : Ignoring CONNECT in session kd43jkqq. Already connected.

KammererTob commented 1 year ago

Fixed by https://github.com/blackhorse-one/stomp_dart_client/commit/18259f156092976ff7795afd3541069edf49fc7c