Closed jello323 closed 5 years ago
Hello @jello323, I could not totally understand your question. There is a built-in method for reconnecting. Reconnect Method
hmm let me rephrase, where should i put the reconnect statement if the connection fail or if the connection is disconnected?
Currently I put the reconnect statement in
func serverDidSendError(client: StompClientLib!, withErrorMessage description: String, detailedErrorMessage message: String?) {
client.reconnect(request: url as NSURLRequest, delegate: self as StompClientLibDelegate, time: 4.0)
}
but it dont seem to work
You should add the code into this delegate. Also, please check the example code. There is an example of reconnect method.
I just closed this issue because of the stale.
You should add the code into this delegate. Also, please check the example code. There is an example of reconnect method.
Following the reconnect example in the example code worked for me. Thank you! 😃
func stompClientDidConnect(client: StompClientLib!) {
socketClient.subscribe(destination: "/topic/some-topic-here")
socketClient.reconnect(
request: socketRequest, delegate: self,
connectionHeaders: socketHeader, time: 2.0
)
}
@failynsedik if you have any other problem or enhancement, I'm glad to improve the library :)
Hi, can I ask when my socket is disconnected or problems connecting how do I make it try to connect again? Or reconnecting if the connection is disconnected?