P Philip Prins Active Member Licensed User Longtime User Aug 13, 2015 #1 How can you detect in the browser that the connection with the B4J server is lost?
R Roycefer Well-Known Member Licensed User Longtime User Aug 14, 2015 #2 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: B4X: 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: B4X: 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: B4X: 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: B4X: function socketDisconnected(event) { alert("Websocket connection closed"); }
P Philip Prins Active Member Licensed User Longtime User Aug 14, 2015 #3 Roycefer said: 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: B4X: 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: B4X: function socketDisconnected(event) { alert("Websocket connection closed"); } Click to expand... Works great,thank you very much... Upvote 0
Roycefer said: 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: B4X: 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: B4X: function socketDisconnected(event) { alert("Websocket connection closed"); } Click to expand... Works great,thank you very much...