blink-realtime

Installation
SKILL.md

Requires auth: initialize with auth: { mode: 'managed' } for realtime to work.

Getting Started

# Publish a message to a channel
blink realtime publish chat-room --type message --data '{"text":"Hello everyone!"}'

# Publish with user context
blink realtime publish notifications --type alert --data '{"level":"info","text":"Deploy complete"}'

MCP Tools

Tool Description
blink_realtime_publish Publish event to a channel

SDK Methods

// Simple subscribe/publish
const unsubscribe = await blink.realtime.subscribe('chat-room', (message) => {
  console.log(message.data)
})

await blink.realtime.publish('chat-room', 'message', { text: 'Hello!' })
unsubscribe()

Channel API (Advanced)

const channel = blink.realtime.channel('game-lobby')

await channel.subscribe({
  userId: user.id,
  metadata: { displayName: user.name, status: 'online' }
})

channel.onMessage((msg) => {
  if (msg.type === 'chat') addMessage(msg.data)
})

channel.onPresence((users) => {
  setOnlineUsers(users)
})

await channel.publish('chat', { text: 'Hello!' }, { userId: user.id })

const history = await channel.getMessages({ limit: 50 })
const users = await channel.getPresence()

await channel.unsubscribe()

Message Format

{
  id: '1640995200000-0',
  type: 'chat',
  data: { text: 'Hello!' },
  timestamp: 1640995200000,
  userId: 'user123',
  metadata: { displayName: 'John' }
}

Presence Format

{
  userId: 'user123',
  metadata: { displayName: 'John', status: 'online' },
  joinedAt: 1640995200000,
  lastSeen: 1640995230000
}

React Cleanup (Critical)

useEffect(() => {
  if (!user?.id) return

  let channel: any = null

  const init = async () => {
    channel = blink.realtime.channel('room')
    await channel.subscribe({ userId: user.id })
    channel.onMessage((msg: any) => setMessages(prev => [...prev, msg]))
  }

  init().catch(console.error)

  return () => { channel?.unsubscribe() }
}, [user?.id])

Never return cleanup from inside an async function — it gets lost. Store channel reference outside and clean up synchronously.

Use Cases

  • Chat apps — messages + presence + history
  • Live collaboration — cursor positions, document edits
  • Notifications — real-time alerts pushed to connected clients
  • Gaming — game state sync, lobby management
  • Dashboards — live data updates
Related skills
Installs
2
GitHub Stars
1
First Seen
Apr 16, 2026
Security Audits