Readonly
clientUnique identifier for the client, used for continuity across the WebSocket connection enabling parallel mocking
Readonly
RouteConvenient access to route types
WebSocket connection.
an error if the client has not been connected yet with Client.connect
Internal
Allows an external handler to be injected into the route handling process for dealing with client-side request interception.
options for the external route handler
a function that extracts a request from the arguments passed to the external handler
a function that transforms the internal result to the external handlers expected result
a function that acts as a handler for the external route handler
Used to connect the client to the WebSocket server. This will also identify the client on the server to enable concurrency for mocking. You need to call this method before you can register any route handlers.
Options for the connection.
Disconnects the WebSocket connection. You need to run Client.connect again to reconnect.
Unregisters a handler for a specific message type.
The type of message to handle.
The original handler function that was registered.
Registers a handler for a specific message type.
The type of message to handle.
The handler function to call when a message of the specified type is received. The handler function receives the parsed message as an argument.
Registers a route handler, when the client receives a request message.
the URL pattern to match against the incoming request URL
the function to handle the request
optional options for the route handler
a route handler ID that can be used to unregister the handler later if required
Used to unregister a route handler.
the route handler ID returned from Client.route
Removes all route handlers
Waits for a request to be made that matches the given URL matcher.
The URL matcher to match against.
Options for the wait operation.
Promise resolving to an instance of Request matching the original request dispatched by the server, rejects with an error if the request is not found within the specified timeout duration.
Client used to interface with the WebSocket server for mocking server-side network requests. And optionally integrating for mocking client-side network requests.