I am using following library for Socket connection https://github.com/facebook/SocketRocket
Following is my code to create socket connection
 socketRocket = SRWebSocket(url: URL(string: streamUrl)!)
 socketRocket?.delegate = self
 socketRocket?.open()
Now if there is any network error like wifi turned off Socket is disconnected and does not work if even if internet is turned on again
I tried following code to reopen socket but it is not working
 socketRocket?.close()
 socketRocket?.open()
How to reopen socket or resume socket after network or any other error occurs?