Skip to content

Channels intregation with Websockets #110

@TheSmuks

Description

@TheSmuks

Channel WebSocket Events


1. Subscription Channels

Connect to these pub/sub channels to receive real-time updates:

Channel Pattern Description
channel:{channel_id} All events for a specific channel
user:{user_id} Personal notifications (bans, kicks)
global App-wide events (new channels)

2. Event Payload Format

All events follow this structure:

{
  "type": "event_type",
  "timestamp": "2025-01-15T10:30:00.000Z",
  "data": { ... }
}

3. Event Types

Category Event Types
Messages channel_message, message_updated, message_deleted, message_reply
Members member_joined, member_left, member_role_updated
Moderation user_banned, user_unbanned, user_kicked
Channel Lifecycle channel_created, channel_updated, channel_deleted
Activity user_typing

4. Message Events

Subscription: channel:{channel_id}


channel_message

Purpose: New message sent to the channel

{
  "channel_id": "uuid",
  "message_id": "uuid",
  "user_id": "uuid",
  "username": "string or null",
  "content": "string"
}

message_updated

Purpose: A message was edited

{
  "channel_id": "uuid",
  "message_id": "uuid",
  "content": "string"
}

message_deleted

Purpose: A message was removed

{
  "channel_id": "uuid",
  "message_id": "uuid"
}

message_reply

Purpose: A reply to an existing message

{
  "channel_id": "uuid",
  "message_id": "uuid",
  "parent_message_id": "uuid",
  "user_id": "uuid",
  "username": "string or null",
  "content": "string"
}

5. Member Events

Subscription: channel:{channel_id}


member_joined

Purpose: A user joined the channel

{
  "channel_id": "uuid",
  "user_id": "uuid",
  "username": "string or null"
}

member_left

Purpose: A user left the channel

{
  "channel_id": "uuid",
  "user_id": "uuid",
  "username": "string or null"
}

member_role_updated

Purpose: A user's role was changed

{
  "channel_id": "uuid",
  "user_id": "uuid",
  "username": "string or null",
  "new_role": "string"
}

6. Moderation Events

Subscription: channel:{channel_id} and user:{user_id}

Warning

These events are broadcast to both channels. The user_id field is only included on the channel subscription.


user_banned

Purpose: A user was banned from the channel

{
  "channel_id": "uuid",
  "user_id": "uuid",
  "motive": "string"
}

user_unbanned

Purpose: A user's ban was lifted

{
  "channel_id": "uuid",
  "user_id": "uuid",
  "motive": "string"
}

user_kicked

Purpose: A user was kicked from the channel

{
  "channel_id": "uuid",
  "user_id": "uuid"
}

7. Channel Lifecycle Events


channel_created

Subscription: global

Purpose: A new channel was created

{
  "channel_id": "uuid",
  "channel_name": "string"
}

channel_updated

Subscription: channel:{channel_id}

Purpose: Channel settings were modified

{
  "channel_id": "uuid",
  "...updated_fields"
}

channel_deleted

Subscription: channel:{channel_id}

Purpose: The channel was removed

{
  "channel_id": "uuid"
}

8. Activity Events

Subscription: channel:{channel_id}


user_typing

Purpose: Typing indicator update

{
  "channel_id": "uuid",
  "user_id": "uuid",
  "username": "string",
  "is_typing": "boolean"
}

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Projects

Status

Backlog

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions