Skip to main content

Realtime

Instant delivery

Instant pub/sub messaging

Real-time event streaming with instant pub/sub delivery. Publish events to channels with instant delivery via SSE. Messages automatically stored for history and replay. Built-in reconnection handling with message acknowledgment.

Overview
Pricing
Usage
Docs
Examples
Emit Eventemit.ts
typescript
import { sylphx } from '@sylphx/sdk'

// Emit a message to a channel
await sylphx.realtime.emit('chat:room-1', 'message', {
  text: 'Hello!',
  userId: '123',
})
Subscribe (React)chat.tsx
typescript
import { useRealtime } from '@sylphx/sdk/react'

function Chat({ roomId }) {
  const { messages, emit, status } = useRealtime(`chat:${roomId}`, {
    events: ['message', 'typing'],
    history: 50,
  })

  return (
    <div>
      {messages.map(msg => <Message key={msg.id} {...msg} />)}
      <button onClick={() => emit('message', { text: 'Hi!' })}>
        Send
      </button>
    </div>
  )
}
Get Historyhistory.ts
typescript
// Get last 100 messages
const messages = await sylphx.realtime.history('chat:room-1', {
  limit: 100,
})

Looking for more examples?

View on GitHub