tinode / ios

Tinodios: Tinode Messaging Client for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Network event processing is inherently serial

aforge opened this issue · comments

It looks like due to the WebSocket library currently in use (tidwall/SwiftWebSocket),
the NW event processing cannot be made concurrent.

Event handlers are called synchronously on the event queue:
https://github.com/tidwall/SwiftWebSocket/blob/master/Source/WebSocket.swift#L910
Events internally are processed synchronously
https://github.com/tidwall/SwiftWebSocket/blob/master/Source/WebSocket.swift#L1571
https://github.com/tidwall/SwiftWebSocket/blob/master/Source/WebSocket.swift#L1580

The best bet to enable concurrency in the app is switching to
https://github.com/daltoniam/Starscream
All event handlers are called asynchronously
https://github.com/daltoniam/Starscream/blob/master/Sources/Starscream/WebSocket.swift#L352
which enables concurrency.

commented

I think this is no longer relevant.