B4J Question websocket with heartbeat

wl

Well-Known Member
Licensed User
Longtime User
Hi,

I'm trying to implement a heartbeat in my B4J webpage that reconnects to the server in case the heartbeat fails (and thus the connection was lost meanwhile).

Does anyone have an example on how to this ?

b4j_onclose ...
b4j_connect ...

Can't fit the puzzle

Thanks !
 

Roycefer

Well-Known Member
Licensed User
Longtime User
Have your JavaScript perform the heartbeat and have your server respond to the heartbeat so that your JavaScript knows it worked. If it fails to get a response after a certain amount of time, call
B4X:
b4j_connect("/WSHandler")
again.
 
  • Like
Reactions: wl
Upvote 0
Top