Closed
Description
You want to:
- report a bug
- request a feature
Current behaviour
When including an async method call as a property to the emit object, the send goes to everyone regardless of if they are in the room or not.
Steps to reproduce (if the current behaviour is a bug)
Not working:
let pairs = await db('currency_pairs')
await Promise.all(
pairs.map(async p => {
socket.to(`orderbook-${p.id}`).emit('orderbook', {
orderbook: await orderbook_service.getOrderbook(p.id),
pairId: p.id
})
})
)
Working:
let pairs = await db('currency_pairs')
await Promise.all(
pairs.map(async p => {
let orderbook = await orderbook_service.getOrderbook(p.id)
socket.to(`orderbook-${p.id}`).emit('orderbook', {
orderbook,
pairId: p.id
})
})
)
Expected behaviour
What is expected?
emit should only send to users which have been joined to the room
Setup
- OS: Windows - Node.js
- browser:
- socket.io version:
2.3.0
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Metadata
Metadata
Assignees
Labels
No labels