B4J Question Detect websocket connection lost

If you are using b4j_ws.js, then open it up in Notepad or something and add this to the bottom, just before the last closing bracket:
Code: Copy
b4j_ws.onclose = function(event)
{
     b4j_runFunction("socketDisconnected", event);
};

And then in your webpage (the one that has <script src="b4j_ws.js"> in it), make sure to implement the "socketDisconnected" function. For example:
Code: Copy
function socketDisconnected(event)
{  
      alert("Websocket connection closed");
}
 
Upvote 0
If you are using b4j_ws.js, then open it up in Notepad or something and add this to the bottom, just before the last closing bracket:
Code: Copy
b4j_ws.onclose = function(event)
{
     b4j_runFunction("socketDisconnected", event);
};

And then in your webpage (the one that has <script src="b4j_ws.js"> in it), make sure to implement the "socketDisconnected" function. For example:
Code: Copy
function socketDisconnected(event)
{ 
      alert("Websocket connection closed");
}

Works great,thank you very much...
 
Upvote 0
Back
Top