@isapir
I am trying to implement a ping/pong mechanism. The issue with using sleep() is that it pauses the entire websocket from listening ( no onMessage events get caught )
private function _ping(websocket){
//returns true if the connection is open, else false
if (arguments.websocket.sendText("ping")){
sleep(20000);
this._ping(arguments.websocket);
}
}
even tried using threads
private function _ping(websocket){
//returns true if the connection is open, else false
if (arguments.websocket.sendText("ping")){
thread {
sleep(20000);
_ping(arguments.websocket);
}
}
}
using thread i do not get the recursive behavior for some reason.
Does anyone have any suggestions/ideas?
@isapir I am trying to implement a ping/pong mechanism. The issue with using
sleep()
is that it pauses the entire websocket from listening ( noonMessage
events get caught )even tried using threads
using thread i do not get the recursive behavior for some reason. Does anyone have any suggestions/ideas?