How do I disconnect client websocket from a worker?

I am using the Web socket server example here https://developers.cloudflare.com/workers/examples/websockets/#write-a-websocket-server I would like to gracefully disconnect the websocket. I tried using
server.close();
client.close();
server.close();
client.close();
however, the client side does not get disconnected. I am testing with websocat from command line and after the close() calls are invoked, the connection seems to remain open (even though no communication comes through). Is there any way to gracefully indicate the connection closing so that client's sockets get disconnected at tcp/ip level?
Cloudflare Docs
Using the WebSockets API · Cloudflare Workers docs
Use the WebSockets API to communicate in real time with your Cloudflare Workers.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?