B4J Question Webview continuously receiving data?


Active Member
Licensed User
Dear All,

I´ve had such headaches with the jetty implementation of websockets. I´ve been told that for most people it works well, but I have one particular website that works well in chrome, but sometimes - there can be weeks inbetween - decides to not let me upgrade the connection. My guess is that this is some low level stuff going on in the headers of the handshake request, which is impossible to fiddle with in the jetty implementation. The site in question probably falls back to an older implementation of websockets that doesn´t cause chrome any issues. I´ve opened numerous threads about the subject on this forum, but there´s really no workaround for it.
So I decided to take a different approach: I´ll be calling the website from a html document containing javascript in a webview, and let it output the sockets that I´ll then be capturing from within b4j using for instance something like
content = (joWV.RunMethodJO("getEngine", Null).RunMethod("executeScript", Array("document.getElementsByTagName('html')[0].innerText")))
The thing is, I need them to come continously into b4j but I´m only aware of one-off methods to capture the data. I know I can do this with a timer, but I find this inconvenient for the scenario in question.

I hope I was clear enough. Any ideas?


Active Member
Licensed User
I think that using a timer is your best option.

Thanks, is it a big burden on the cpu load if such a timer has an interval of 1 ms, constantly checking for new ws frames?

EDIT: I actually think I just came up with a better solution. I will try to set up a websocket server in b4j, to which I will be sending frames when they arrive from within the javascript.
Last edited:
Upvote 0