Legacy chat SSE

New integrations should use the unified EventSub stream via streamEventSub.

Stream public chat messages

Connect to /v1/events/chat/messages/stream with optional role filtering.

chat-stream.ts
const stream = client.streamPublicChatMessages({
  roles: ['AI', 'Streamer'],
  onOpen: () => console.log('Listening...'),
  onMessage: (msg) => console.log(`${msg.role}: ${msg.content}`),
  onError: (err) => console.error('Stream error', err),
  onClose: () => console.log('Stream closed')
});

// Later:
stream.close();