Darren
Darren
CDCloudflare Developers
Created by Darren on 1/6/2025 in #workers-help
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?
1 replies