vgno / ssehub

Server Sent Events Hub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Send history for channel when client reconnects

rexxars opened this issue · comments

When a client disconnects because of network issues or a timeout of some sort, the client will reconnect with an HTTP header (Last-Event-ID) specifying (obviously) the ID of the last event that was received. It's then up to the server (the hub) to send back all messages the client has lost since the disconnect.

We also need to check for the query parameters evs_last_event_id and lastEventId, which various polyfills use instead of the header when IE connects cross-domain.

The messages that are returned are simply sent as regular messages as if they were "new", but obviously only to the client that requested them.

After some discussion today, I think we landed on skipping the ZMQ step and instead maintaining a local history which is populated on startup. The header/query string stuff is still relevant, so I'll rename and reword this task a bit.

Implemented in commit 2e07b9d