miniflare
miniflare copied to clipboard
Closing WebSocket in Durable Object results in Unhandled Promise Rejection: TypeError: WebSocket already closed
Miniflare 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.