https://kotlinlang.org logo
#http4k
Title
# http4k
a

Andrew O'Hara

07/22/2022, 8:10 PM
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

dave

07/23/2022, 11:15 AM
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

Andrew O'Hara

07/23/2022, 3:59 PM
I just made a PR. The tests encapsulate my use-case pretty well. It turns out most of the pieces were already there.
d

dave

07/23/2022, 4:04 PM
Nice work 👍🙃