I would like to send periodic pings to server to keep the connection alive.
This is the function to send ping
socket.writePing(NSData())
But I am not getting the pong back
func websocketDidReceivePong(socket: WebSocket){
wsConsole.text = wsConsole.text .stringByAppendingString("\n websocket received pong")
}
the above delegate will get fired when server sends back the pong.
FYI:
I am able to successfully establish web socket connect send message and close connection and I have implemented and I have given socket.delegate=self
WebSocketPongDelegate
Here is the web socket url that I am using for testing purposes
ws://echo.websocket.org/
I am wondering why I am not getting the pong back from web socket server.