79749965

Date: 2025-08-29 07:53:40
Score: 0.5
Natty:
Report link

When writing client WebSocket code, if the client needs to initiate shutdown, call CloseOutputAsync. This sends a Close frame and moves the socket into the CloseSent state. The socket won’t actually reach the Closed state until the server responds, so you should continue monitoring the socket state until the handshake completes.

When writing server WebSocket code, if the server needs to initiate shutdown, call CloseAsync. This method manages the entire closing handshake for you, ensuring the connection transitions cleanly to the Closed state.

Reference: https://mcguirev10.com/2019/08/17/how-to-close-websocket-correctly.html

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When
  • Low reputation (1):
Posted by: user31360146