B4J Question Jetty Server: I cannot understand this error.

hatzisn

Expert
Licensed User
Longtime User
If I load a page with a websocket in a jetty server (11.0.24) that shows some calculations of an app and leave it there to be updated by the timer eventually I get this error when I try to read the value of a hidden field. What is this?. I have enabled the reconnect websocket javascript and in Developer Tools > Console of the browser I see no error. The code breaks there but in the Network Tab of Developer Tools when I see the data of websocket the messages are passing through correctly. Any advice someone?

 
Last edited:

teddybear

Well-Known Member
Licensed User
Based on this log, the WebSocket connection had already been closed when Ws.Flush was called.
If the Ws.Flush is called in the event Timer1_Tick, do you disable the timer in the event WebSocket_Disconnected?
B4X:
Private Sub WebSocket_Disconnected
    timer1.Enabled = False
End Sub
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Thank you both for answering. I use a background worker that handles the DB connection. There is, where the StartMessageLoop is located. When the app is disconnected I already have added the reconnect-websocket.js and I thought that if it reconnects the ws.GetElementByID("hidobj").GetVal.Value will execute correctly, so no timer1.Enabled = False - I just placed it in Try-Catch. I checked it thoroughly today and I cannot reproduce the error at all.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…