Hello everybody,
I'm working on an app that implements a communication protocol on top of WebSocket using the Network Framework via NWProtocolWebSocket
/NWConnection
.
The issue I'm seeing is that on macOS (at least under macOS 13.0 Ventura) when calling .cancel()
on the NWConnection
on say the server side, the client does not disconnect gracefully. Instead the client receives a POSIXErrorCode(rawValue: 96): No message available on STREAM
on the NWConnection.receiveMessage
block.
You can verify this behaviour in the testDisconnect()
test case in https://github.com/pusher/NWWebSocket
(Disclaimer: I'm not the author of NWWebSocket but it shows the same issues that I'm experiencing in my code).
The same issue didn't show up in the iOS Simulator, where the connection closed correctly. Now I'm wondering if this is a bug in macOS 13 Ventura or if we can do something about it by changing the disconnect code.
Any help is greatly appreciated...
Thank you, Bastian Roessler