Closing WebSocket in Durable Object results in Unhandled Promise Rejection: TypeError: WebSocket already closed
See original GitHub issueMiniflare version: 2.6.0
While closing the WebSocket from the client side, it is expected to close it in the Durable Object right after, otherwise it won’t be closed. So closing negotiation goes like: Client > DO > Client.
Miniflare however throws Unhandled Promise Rejection: TypeError: WebSocket already closed
error when Durable Object tries to close the socket when the ‘close’ event is received from the client.
Apparently, with Miniflare the client is able to close the socket prematurely without waiting for the Durable Object to close the server socket first.
Issue Analytics
- State:
- Created a year ago
- Comments:8
Top Results From Across the Web
javascript - How to catch and deal with "WebSocket is already ...
The easiest way is to check if the socket is open or not before sending. For example - write a simple function: function...
Read more >Changelog - Miniflare
Ensure calling WebSocket#close() before returning a WebSocket response sends the correct close code and reason. Fix delivery of incoming WebSocket error events ...
Read more >Event-Driven and Asynchronous Programming with Python
This check is necessary because closed connections are represented as read events, so a read handler run immediately prior might remove a closed...
Read more >closing websockets : r/ComputerCraft - Reddit
Is there a way to close web sockets when a program is terminated? I know you use ws.close() to close them normally, but...
Read more >Node.js 8 the Right Way - Library IT
Node.js 8 the Right Way is an excellent guide for building robust Node.js applica- ... The special URL beginning with ws:// is a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey! 👋 Thanks for the repo! 🙂 I’m able to reproduce the issue, and will have a go at fixing this soon. 👍
Alright, I’ll prepare a repo for that.