Open raketenolli opened 4 years ago
My understanding is that no server is actually created, and instead the server and client are connected in-memory by doing string matching to see if the "fake URL" provided to server and client is the same. Thus it only works in the same script. However, it is hard to tell for sure because there is no documentation aside from the sparse README :/
This is more of a support question than an actual issue, if applicable please refer to the proper resources for asking this.
I mocked a websocket server similar to the one described in the "Usage" section of the readme.
If I add a
WebSocket
directly inside this file, it receives the messages. But if I create a second scriptand start it just after launching the first one, I'd expect it to be able to connect to the mocked server at
localhost:8080
and receive and display the messages. Instead I getin the console. Same result if I create an HTML page with a similar
<script>
and open it just after starting the mock server.More generally, how can I use mock-socket to test the behavior of web applications that rely on websocket connections for some of their functionality?