Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support non-websocket streaming consumers #331

Open
paulgb opened this issue Nov 7, 2024 · 0 comments
Open

Support non-websocket streaming consumers #331

paulgb opened this issue Nov 7, 2024 · 0 comments

Comments

@paulgb
Copy link
Member

paulgb commented Nov 7, 2024

Some environments still block WebSocket connections. We already have a POST endpoint for sending updates, so it would be cool if we could pair that with a streaming HTTP endpoint.

One way it could work is that the client would send a POST request to the /as-stream endpoint, containing its state vector. The server would stream back updates in binary format, and the client would read them.

We would need to implement some form of framing inside the HTTP stream, since it is just a stream of bytes. We would also need to implement a way of detecting a blocked WebSocket connection and attempt a fetch connection instead.

The initial handshake with this method would only synchronize server state to the client, not client state to the server. To send client state to the server, we could implement a /state-vector endpoint that returns the server's current state vector, and then have the client send a POST request to the /update endpoint containing any local updates.

Alternately, if our own provider becomes more stateful, we could just emulate the stateful connection over POST messages up to the server and streaming messages down to the client.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant