Imgur / incus

incus is a middleware for distributing messages via websockets, long polling, and push notifications
MIT License
361 stars 37 forks source link

When long polling we need to buffer commands #7

Open briankassouf opened 10 years ago

briankassouf commented 10 years ago

When commands are received for a client that is longpolling, then we need to buffer commands that arrive between when the message is sent to the longpoller, and when they reconnect. For example,

t=0, A connects via longpoll
t=100, message is received by A's long poller, and A's long poller disconnects
t=101, message is received by Incus for A, but is dropped because there is no client for A
t=102, A connects via longpoll

Instead, we need a threshold (preferably in time-units rather than absolute number of messages) buffer:

t=0, A connects via longpoll. 
t=100, message is received by A's long poller, and A's long poller disconnects
t=101, message is received by Incus for A, and is placed into a buffer
t=102, A connects via longpoll, and a pending message is dispatched, and A's long poller disconnects.
t=104, A connects via longpoll.