Closed jabinb closed 2 years ago
@jabinb Thanks a lot for taking the time to create this PR. Currently, Deno Deploy has an execution limit of 50ms, which would be a blocker for supporting web sockets. We've reached out to Deno team to get it clarified.
We'll contact you and re-open this PR if Deno Deploy changes its execution time limits to support web sockets.
What kind of change does this PR introduce?
Adds support for relaying WebSockets with Edge Functions by allowing upgrade requests and then relaying messages between the two sockets.
What is the current behavior?
Cannot establish WebSocket requests as
GET
requests return an unsupported error.What is the new behavior?
WebSockets are supported, while denying still denying normal
GET
requests.Additional context
This is a supported feature with Deno Deploy so unless there's some conflict with the implementation between Supabase <-> Deno Deploy this should work.
If you want me to add tests let me know, there wasn't any existing ones to use as a base.
https://deno.com/blog/deploy-streams#websockets
As a use-case, I'm using WebSockets for tunneling TCP connections, i.e. SSH/Telnet sessions, which doesn't quite fit within the new Multiplayer features as the other end of the channel is not a client/subscriber but a TCP socket which I don't have control over.