Thank you for sharing an awesome Websocket lib!
Question: Does the lib support any reconnect handling? Thanks!
Welcome 馃槃. It does not do any auto reconnecting, but in the didDisconnect closure or delegate you can call connect again which will attempt a reconnection. This allows maximum flexibility to pick when is an appropriate time to reconnect.
So what I need to do is call connect again in didDisconnect method! This means I can reuse WebSocket instance. Is that right? Or I have to create another WebSocket instance in didDisconnect method and then connect?
Thank you!
correct, the same instance can be used.
func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
//other logic to see if you want to reconnect
socket.connect()
}
Most helpful comment
Welcome 馃槃. It does not do any auto reconnecting, but in the didDisconnect closure or delegate you can call
connectagain which will attempt a reconnection. This allows maximum flexibility to pick when is an appropriate time to reconnect.