Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the broadcasting API #5

Open
kettanaito opened this issue Mar 14, 2024 · 2 comments
Open

Support the broadcasting API #5

kettanaito opened this issue Mar 14, 2024 · 2 comments

Comments

@kettanaito
Copy link
Member

MSW ws now supports broadcasting so we should propagate that support to the SocketIO binding.

  1. Look up what API SocketIO uses for broadcasting;
  2. Implement that API using .broadcast() and .broadcastExcept() methods on the MSW event handler.
@kettanaito
Copy link
Member Author

Alas, the binding depends on the Interceptors, and there's no broadcasting concept there.

@kettanaito
Copy link
Member Author

I think the binding should accept the entire WebSocket link. That way, it can also use the broadcasting capabilities of MSW relying on its own client manager.

import { ws } from 'msw'
import { bind } from '@mswjs/socket.io-binding'

const api = bind(ws.link('*'))

api.on('connection', (args) => {})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant