A WebSocket.readyState property that is compatible with the native property
(https://developer.mozilla.org/docs/Web/API/WebSocket/readyState) and the ws package's
property (https://github.com/websockets/ws/blob/HEAD/doc/ws.md#websocketreadystate)
If set, this callback is invoked with the parsed payload every time the client calls send.
Use it to assert on what the client tried to send.
A WebSocket.addEventListener method that is compatible with the native method
(https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) and the ws
package's method
(https://github.com/websockets/ws/blob/HEAD/doc/ws.md#websocketaddeventlistenertype-listener-options)
A WebSocket.close method that is compatible with the native method
(https://developer.mozilla.org/docs/Web/API/WebSocket/close) and the ws package's method
(https://github.com/websockets/ws/blob/HEAD/doc/ws.md#websocketclosecode-reason)
A WebSocket.removeEventListener method that is compatible with the native method
(https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) and the ws
package's method
(https://github.com/websockets/ws/blob/HEAD/doc/ws.md#websocketremoveeventlistenertype-listener)
A WebSocket.send method that is compatible with the native method
(https://developer.mozilla.org/docs/Web/API/WebSocket/send) and the ws package's method
(https://github.com/websockets/ws/blob/HEAD/doc/ws.md#websocketsenddata-options-callback)
Dispatch a synthetic message event as if the host pushed data to this client.
A mock CommonWebSocket implementation for unit tests. Drop-in replacement for the global
WebSocketconstructor passed toRestVirClient.connectWebSocket'swebSocketConstructorparam. The test then drives the mock via getLastMockWebSocket to dispatch synthetic events, inspect captured constructor args, or capture outbound client sends via MockWebSocket.sendCallback.Example
Package
@rest-vir/api