Problem
When a WebSocket mock is updated via the Admin API, active clients continue receiving stale data until they manually reconnect.
This is a significant pain point for testers who do not always have access to the application under test to trigger a reconnect or restart the service.
Having the mock server close connections automatically solves the problem without any intervention in the system being tested.
Proposed Solution
When a WebSocket mock is updated or deleted, close all active connections on that endpoint with close code 1012 Service Restart (RFC 6455).
The client reconnects automatically and picks up the new configuration.
Alternatives Considered
Hot-updating the Endpoint config in-place — without disconnecting clients.
This works for matchers and defaultResponse, but does not work for scenario:
ScenarioExecutor holds a direct reference to the old scenario object running in its own goroutine; swapping the config has no effect on the already-running executor.
It also requires additional refactoring for thread safety.
Use Case
Testing real-time streaming integrations: market data feeds, IoT sensor streams, push notifications.
A developer or tester changes the mock data on the fly to exercise different conditions (anomalous values, edge cases) without restarting the mock server and without access to the application under test.
Additional Context
Close code 1012 Service Restart is a standard RFC 6455 signal indicating the server is restarting; most WebSocket client libraries handle it automatically with built-in reconnect logic.
I’d be happy to implement this, including tests, if the maintainer is open to contributions.
Problem
When a WebSocket mock is updated via the Admin API, active clients continue receiving stale data until they manually reconnect.
This is a significant pain point for testers who do not always have access to the application under test to trigger a reconnect or restart the service.
Having the mock server close connections automatically solves the problem without any intervention in the system being tested.
Proposed Solution
When a WebSocket mock is updated or deleted, close all active connections on that endpoint with close code
1012 Service Restart(RFC 6455).The client reconnects automatically and picks up the new configuration.
Alternatives Considered
Hot-updating the
Endpointconfig in-place — without disconnecting clients.This works for
matchersanddefaultResponse, but does not work forscenario:ScenarioExecutorholds a direct reference to the old scenario object running in its own goroutine; swapping the config has no effect on the already-running executor.It also requires additional refactoring for thread safety.
Use Case
Testing real-time streaming integrations: market data feeds, IoT sensor streams, push notifications.
A developer or tester changes the mock data on the fly to exercise different conditions (anomalous values, edge cases) without restarting the mock server and without access to the application under test.
Additional Context
Close code
1012 Service Restartis a standard RFC 6455 signal indicating the server is restarting; most WebSocket client libraries handle it automatically with built-in reconnect logic.I’d be happy to implement this, including tests, if the maintainer is open to contributions.