leonardoventurini/helene

The server sent events mode might not fully work on multi instance clusters

Opened this issue · 1 comments

Right now the init call (http) needs to occur on the same server as the event source connection is established at for some event event functionality to work.

Authentication actually works fine since we send the token in the HTTP request for the EventSoource:

const serverContext = await this.getServerContext(clientNode)

The problem is when we call sendEvent to the connection instance coming from a method call:

const clientNode = this.server.httpTransport.eventSourceClients.get(

We need to leverage Redis pub/sub for this.

For now using the normal event functionality should work fine.

The main reason I opted to implement SSE/EventSource is because WebSockets don't play well with iOS/Safari PWAs. Once you minimize and then bring it back after some time the WS connection cannot be re-established. I tried all workarounds I could possibly think of to no avail.