Realtime

Publish message to channel

Publish a message to a realtime channel. The message is persisted in a Redis Stream and immediately broadcast to all active WebSocket subscribers via Redis Pub/Sub.

Streams are automatically trimmed to 1 000 messages to prevent unbounded memory growth.

post/api/realtime/{project_id}/publish

Request

  • Base URL
    https://core.blink.new
  • URL
    https://core.blink.new/api/realtime/{project_id}/publish
  • Auth
    HTTP bearer

Path parameters

project_idstring required
Example:my-project-123

Unique identifier for the project

Request body

channelstring required

Channel name to publish to

typestring required

Message type identifier

dataunknown required
userIdstring

Optional user ID for the message

metadataobject

Optional metadata for the message

Example request

{
  "channel": "chat-room-1",
  "type": "message",
  "data": {
    "text": "Hello world!",
    "user": "john_doe"
  },
  "userId": "user_123"
}

Response

Message published successfully

messageIdstring

Unique identifier for the published message

channelstring

Channel the message was published to

timestampinteger

Unix timestamp when message was published

Example response

{
  "messageId": "1640995200000-0"
}

Changes

No recorded changes to this operation across all 1 revision of this API.