You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to create multiple simultaneous sockets and starscream consistently hangs if I try to create over 64 of them.
So this code fails, the connected callback never gets triggered.
# Class varvar websockets =[WebSocket]()
# In a method
for index in 1...64{
if let newWebSocket =WebSocket(url: YOUR_WS_URL)asWebSocket?{
newWebSocket.onConnect ={print("\(index) Connected")}
newWebSocket.onDisconnect ={(error)->Voidinprint("\(index) Discconnected")}print("\(index) Connecting")
newWebSocket.connect()self.websockets.append(newWebSocket)}}
We have looked into a singleton thread and using a stream based APIs to fix this issue, but it requires a rather large refactor we haven't had time to finish yet. If you would like to take a stab at it, PR is welcomed.
I need to create multiple simultaneous sockets and starscream consistently hangs if I try to create over 64 of them.
So this code fails, the connected callback never gets triggered.
Seems to be related to this issue http://stackoverflow.com/questions/15150308/workaround-on-the-threads-limit-in-grand-central-dispatch and the way starscream always dispatches on the background https://github.com/daltoniam/Starscream/blob/master/WebSocket.swift#L144
Maybe move this into a static private operation queue?
The text was updated successfully, but these errors were encountered: