Make a small buffer for active trackers that contains recent events. When a client joins via WebSocket subscribe or long polling request, server sends contents of buffer.
When an event is published it is stored to small per tracker cache (e.g. ttl 5 min, max-size 100)
When client connects, contents of buffer are sent to client.
Subscribe command should have parameter latestStoreTime, server sends only events later than that from buffer and/or database.
This way, if client disconnects for a short time, the client will not miss any events.
Make a small buffer for active trackers that contains recent events. When a client joins via WebSocket subscribe or long polling request, server sends contents of buffer.
latestStoreTime
, server sends only events later than that from buffer and/or database.This way, if client disconnects for a short time, the client will not miss any events.