Replies: 1 comment 6 replies
-
|
Hi, @colinbes.
Yes, that's precisely what const api = ws.link('wss://example.com.chat')
export const handlers = [
api.on('connection', () => {
// ...
}),
http.post('/something', () => {
api.broadcast(yourMessage)
})
]You also have access to the set of intercepted WebSocket clients under Does this answer your question? Feel free to ask follow-ups. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I battled coming up with a title to hint at what I am wanting to do.
In my handler I have various rest end point mock handlers as well as io socket listener for mocking of websockets.
I am wanting to mock my backend server behavior which emits status messages of application (running in backend).
For my mocks, as example, when endpoint PUT /app/generator/start I want to start an interval timer and every interval period emit a websocket message sending update of backend process.
I see that ws.link's return value has a broadcast member - would it be correct to use this to emit message to all connected clients?
I am not sure how I would send event plus message though - something like client.emit("send:status", "some valuable update")
Beta Was this translation helpful? Give feedback.
All reactions