Starscream: Any API for reconnect handling automatically?

Created on 18 Jul 2016  路  3Comments  路  Source: daltoniam/Starscream

Thank you for sharing an awesome Websocket lib!
Question: Does the lib support any reconnect handling? Thanks!

Most helpful comment

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.

All 3 comments

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()
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dezabro picture Dezabro  路  3Comments

adrian-niculescu picture adrian-niculescu  路  4Comments

blajivskiy picture blajivskiy  路  6Comments

NickNeedsAName picture NickNeedsAName  路  5Comments

AdamMak picture AdamMak  路  3Comments