Open KaylaBrady opened 3 months ago
This error is benign, the print
statement in the receive
loop can be removed.
Upon testing, self
(which is the WebSocketTask) is nil
and the reconnect logic is not triggered. The correct solution here is to just remove the print
call on PhoenixTransport.swift:293
.
I'm following the example for disconnecting from a socket when the app is backgrounded for my SwiftUI app. After calling
socket.disconnect()
using v5.3.3 of this library, I reliably get the following error message at PhoenixTransport.swift#L293Error when receiving Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected" UserInfo={NSErrorFailingURLStringKey=wss://phoenix-chat.fly.dev/socket/websocket?vsn=2.0.0, NSErrorFailingURLKey=wss://phoenix-chat.fly.dev/socket/websocket?vsn=2.0.0}
.Here is an example app that doesn't involve joining any channels for simplicity, though I still get this error message when channels have been joined & left too.
I would expect no error message in this case since the socket has been intentionally closed.
Here are the full logs from opening the app, backgrounding it, and re-opening it.