Creates a stub that has the same initial responses, but replaces the function that adds messages to be received using WebSocket.receive, in reaction to WebSocket.send being invoked.
Creates a stub that has the same initial responses, but replaces the function that adds responses to be received using WebSocket.receive, in reaction to WebSocket.send being invoked.
Creates a stub that has the same initial responses, but replaces the function that adds responses to be received using WebSocket.receive, in reaction to WebSocket.send being invoked.
More powerful version of thenRespond, as the given function can additionally use state and implement stateful logic for computing response messages.
Creates a stub that has the same initial responses, but replaces the function that adds responses to be received using WebSocket.receive, in reaction to WebSocket.send being invoked.
Creates a stub that has the same initial responses, but replaces the function that adds responses to be received using WebSocket.receive, in reaction to WebSocket.send being invoked.
More powerful version of thenRespond, as can result in the websocket to become closed.
Creates a stub that has the same initial responses, but replaces the function that adds responses to be received using WebSocket.receive, in reaction to WebSocket.send being invoked.
Creates a stub that has the same initial responses, but replaces the function that adds responses to be received using WebSocket.receive, in reaction to WebSocket.send being invoked.
More powerful version of thenRespond, as the given function can additionally use state and implement stateful logic for computing response messages, as well as result in the websocket to become closed.
A simple stub for websockets that uses a queue of responses which are returned when the client calls WebSocket.receive.
New messages can be added to queue in reaction to WebSocket.send being invoked, by specifying the behavior using one of the thenRespond variatns.
For more complex cases, please provide your own implementation of WebSocket.