Closed Michael-Kr closed 4 years ago
hi @Michael-Kr , thanks for letting us know. Currently we don't have plan to update that piece of code from the 3rd party if it's working fine cause that problematic code path won't be executed under our use case. But definitely we will keep that in mind. Thanks!
I've accidentally noticed that you use the same Websocket.swift by Dalton Cherry as I do. I've identified an edge case issue when
disconnect(forceTimeout:)
called with a non-nil timeout value. The timeout action is triggered on thecallbackQueue
which is main queue by default and because thedisconnectStream
inside is calledwith error = nil
thewriteQueue.waitUntilAllOperationsAreFinished()
will be called on main thread and will block the UI. I see you currently don't apply the timeout so thecallbackQueue
to be the main queue is probably not very painful, but still decided to let you know :) There are several easy ways to overcome the potential issue:callbackQueue
not the main queuedisconnect(forceTimeout:)
-self?.disconnectStream(nil)