SignalR-Client-Swift
SignalR-Client-Swift copied to clipboard
Crash on ios 12 devices when skipNegotiation is true
Hello,
We are experiencing a crash on ios 12 devices when skipNegotiation is true.
Fatal error: 'try!' expression unexpectedly raised an error: SwiftSignalRClient.SignalRError.noSupportedTransportAvailable: file SwiftSignalRClient/HttpConnection.swift, line 72
if options.skipNegotiation {
transport = try! self.transportFactory.createTransport(availableTransports [TransportDescription(transportType:TransportType.webSockets, transferFormats: [TransferFormat.text, TransferFormat.binary])])
startTransport(connectionId: nil)
}
~~You haven't included logs so I can only suspect that WebSockets are not enabled on the server or the webSocket transport is not enabled on the server side.~~
Actually, I take it back. WebSocket transport is only available on iOS 13 and newer. Negotiation can only be disabled for webSockets so if you set skipNegotiation to true it enforces using the webSocket transport which is not available on pre-iOS13 clients and hence the exception.
Possibly the client should not exposed the skipNegotiation
option on pre-iOS 13 as it cannot work.
Thank you for the swift response. We will user other transports.
The client should automatically pick long polling on pre-iOS13 and webSockets and n iOS13 and newer if you don’t try to skip negotiation
On Mon, Sep 5, 2022 at 11:55 PM Mert Köküşen @.***> wrote:
Thank you for the swift response. We will user other transports.
— Reply to this email directly, view it on GitHub https://github.com/moozzyk/SignalR-Client-Swift/issues/252#issuecomment-1237732807, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK7JJDOYLR3AP2GXS5RX6DV43TGXANCNFSM6AAAAAAQEV7GC4 . You are receiving this because you commented.Message ID: @.***>
We needed to skipNegotiation to force it to use web sockets to we don't need to configure sticky sessions on our load balancer. But now we will probably go with sticky sessions. Thanks again.
Got it. Unfortunately the limitation stems from the fact that URLSessionWebSocketTask is only supported on iOS13 and newer.