Qabel / qabel-drop

(B2C) :love_letter: Qabel messaging server
Other
17 stars 11 forks source link

Support a sane WebSocket protocol #61

Closed enkore closed 7 years ago

enkore commented 8 years ago

Ideally we want to support the REST API, the FCM push service and websockets in one server with as little hassle as possible (previous hassle).

Estimate := 3 in the assumption that e.g. Tornado's websockets (or what we'll be using, but Tornado is nice and we have great experience with it on the blockserver) doesn't explode as hard.

Sane := not a one way trip, and doesn't require one WebSocket connection per drop the client wants. Instead, something like this conceptually (> := client-to-server, < := server-to-client)

> subscribe drop_id [drop_ids...]
...
< drop drop_id message
> post drop_id message
< drop drop_id message
< drop other_drop_id message
...
> unsubscribe  drop_id [drop_ids...]

(note: "post drop_id message" can be implement with almost no code by just forwarding it to the REST API - it has the advantage that it doesn't require the client to make another connection to POST)

When TLS (wss://) is used this also makes it harder to monitor everything, since drops are multiplexed

(note 2: uWSGI does heartbeating, there is no need at all to replicate heartbeats in the app protocol)

enkore commented 8 years ago

Simplifications: