Websockets is a new concept to me. I have a clien...
# http4k
a
Websockets is a new concept to me. I have a client-side app that polls a
WsClient
in a thread, but I would love to make that event-driven, as is done on the server-side. It turns out
WebsocketClient.nonBlocking
returns
Websocket
that offers an
onMessage
hook. Perfect. But I'm not sure how to get a test version of that.
WsHandler.testWsClient
gave me a
WsClient
, which worked perfectly for my old tests. But I'm having a hard time finding out how to make a test version of the non-blocking
Websocket
. Is it not possible? Or is it just not yet implemented?
d
It's not implemented, and not something that we've looked at before. Can you put a quick gist together with the kind of test that you want to write and maybe we can go from there?
a
I just made a PR. The tests encapsulate my use-case pretty well. It turns out most of the pieces were already there.
d
Nice work 👍🙃