How can I test my Ktor client WebSocket code? Do I need to fake the WebSocket implementation, or can I swap in a lower-level component for tests, sort of like the mock engine for http?
s
Simon Binder
07/11/2025, 7:27 AM
We have looked at something like this which essentially gives you a pair of a client and server engine that talk to each other. So then you can write a ktor server to setup a websocket server and test your clients against that
a
Aleksei Tirman [JB]
07/11/2025, 8:20 AM
You can use the testApplication to test the interaction through WebSockets.