WebSockets and other realtime communication #3460
Replies: 1 comment 2 replies
|
Hi @canadaduane, thanks for bringing this up. Unfortunately, we do not have WebSocket support at the moment. (@dicej did that SIP end up going anywhere? Should we pick it up after the WASI P3 work is released?) I believe it's possible to put a WebSocket bridge in front of Spin, but I'm not familiar with the details (again I think @dicej is the one who's looked into this). The upcoming Rust SDK has a sample for server sent events (https://github.com/spinframework/spin-rust-sdk/tree/main/examples/server-sent-events). This will work with Spin 4, which should be out next week,or the canary release that you can get from GitHub (https://github.com/spinframework/spin/releases/tag/canary). It should be reasonably easy to port to other languages once we release Spin 4 libraries for those. HTTP polling should also work in Spin 4/canary, and we can support you with that. (Both of these can be made to work in Spin 3, but it's more of a faff. Spin 4 async and concurrency greatly simplify this sort of thing!) However, both SSE and long polling mean you are dealing with long-lived components. These work fine in the CLI and SpinKube, but there are other hosts that limit connection times. Long term we'd like to find a WebSocket solution that plays nicely with Spin's naturally stateless idiom, but we're not there yet... Hope this helps - sorry not to have a more positive answer for you, but I'm happy to discuss possible approaches further, or try to answer any questions! |
Uh oh!
There was an error while loading. Please reload this page.
Is Spin suitable to realtime communication? I've been poking around the edges to see if it would be able to support WebSockets, for example, but there is only a very little information available, mainly this PR:
Alternatives that may work for realtime communication (but would be inferior to WebSockets for my case):
Can anyone weigh in here on behalf of someone who is completely new to Spin? Thanks!
All reactions