Broadcast

Send ephemeral messages on channels: cursors, typing indicators, game state.

JavaScript
const room = stitchdb.channel('room-1')

room.on('broadcast', { event: 'cursor' }, ({ payload }) => moveCursor(payload))
await room.subscribe()

room.send({ type: 'broadcast', event: 'cursor', payload: { x: 120, y: 48 } })

#Options

JavaScript
const room = stitchdb.channel('room-1', {
  config: { broadcast: { self: true, ack: true } }, // receive your own messages, wait for the server
})

Broadcast messages are not stored. Send them from SQL with realtime.send().