(java) Listen To Websocket Messages With Htmlunit
I am trying to listen to websocket messages on a particular page. It seems like HtmlUnit has support for WebSockets, but I can't find any documentation/tutorial or even an answer
Solution 1:
As of now, WebSocket
is supported only from the the JavaScript side by this class, and there is no API from HtmlUnit to control it.
The current implementation is basic, I will see if there is a way to intercept the traffic from Jetty Websocket client, it can be added to the public API.
Update:
WebClient now has getInternals().addListener()
. Once the listener.created(WebSocket)
is called, you should invoke webSocket.setWebSocketListener()
with the WebSocketListener
.
Test case is here.
This feature is included in the latest build.
Post a Comment for "(java) Listen To Websocket Messages With Htmlunit"