Queue events for websocket clients between connections
markusressel opened this issue · 0 comments
markusressel commented
As mentioned in #27 the websocket event queue could be improved.
- to be able to remember which client hasn't received which event yet, the client needs to have a unique identifier
- the identifier can be an arbitrary, url header conforming string (f.ex.
my-client-name
ordc1f14fc-a7a6-4102-af60-2b6e0dcf744c
) - the identifier should be client controlled and passed to barcode-server when connecting using a
Client-ID
header - when a new client connects, barcode-server should perform a sanity check whether a client with the given identifier is already connected and, if so, reject the connection
- if a client disconnects (for whatever reason) and then reconnects, all missed events should be sent to it, one after another
- clients should have the ability to avoid this and skip/drop missed events when connecting, by passing an (empty)
Drop-Event-Queue
header upon connecting
An example connection using websocat would look like this:
websocat - autoreconnect:ws://127.0.0.1:9654 --text --header "Client-ID:dc1f14fc-a7a6-4102-af60-2b6e0dcf744c" --header "Drop-Event-Queue:" --header "X-Auth-Token:EmUSqjXGfnQwn5wn6CpzJRZgoazMTRbMNgH7CXwkQG7Ph7stex"