We have a working ASP.NET Web API REST service that uses WebSockets on one of our controller\'s methods using HttpContext.AcceptWebSocketResponse(..).
The socket handl
https://www.salmanq.com/blog/5-things-you-probably-didnt-know-about-net-websockets/
...The graceful way is CloseAsync which when initiated sends a message to the connected party, and waits for acknowledgement. ...The other option is to use CloseOutputAsync this is more of a “fire-and-forget” approach. ...
It looks like you're getting a closing message;
if (result.MessageType == WebSocketMessageType.Close ||
currentSocketState == WebSocketState.CloseReceived)
so I'd say you'd be just fine using CloseOutputAsync
because you've already gotten a message that says "I want to close this connection".