GhaylStackDocumentationv1.0.2
العربيةWebsite
Platform modules

Platform modules

Channels, direct messages and realtime chat

Create conversations, enforce membership and keep message history synchronized with live updates.

Choose the conversation type

Chat supports named channels, direct messages and group direct messages. Its REST API begins with /api/v1/chat. A named channel has a name, description and privacy flag; its creator becomes the first channel administrator. Direct messages use a stable pair of user IDs, while a group direct message requires at least three distinct members.

List conversations through /channels, discover available channels through /channels/discover, and use POST /dms for the find-or-create direct conversation flow. Keep conversation membership separate from the user's general permission to open Chat.

Send a message and a reply

Create a channel with POST /api/v1/chat/channels, then add the intended members through /channels/{id}/members. Send messages through POST /channels/{id}/messages.

The message command carries a body, an optional parent message ID and attachments. The handler requires channel membership. A parent must belong to the same channel, and replies are limited to one level: a reply to another reply is rejected.

Retrieve /channels/{id}/messages for persisted history. Open /messages/{id}/replies for its thread and /channels/{id}/pinned for pinned messages. Editing, deletion, reactions, pinning and read markers have dedicated operations; do not implement them by rewriting the entire conversation.

Apply permissions and membership together

Capability Permission
Read channel lists and messages Permissions.Chat.Channels.View
Create a conversation Permissions.Chat.Channels.Create
Send, react or pin Permissions.Chat.Messages.Send
Edit own message Permissions.Chat.Messages.EditOwn
Delete own message Permissions.Chat.Messages.DeleteOwn
Restore archived channels Permissions.Chat.Channels.ManageAll

The permission gate is followed by conversation-specific rules. For example, Send permission does not make a user a member of every private channel. Archiving preserves channel membership records so administrative restoration can recover the conversation membership.

Connect live updates

After saving a message, the handler sends ChatMessageCreated to the SignalR group for that channel. AppHub joins a user's existing channels on connection. JoinChannel(channelId) supports channels created or joined after the connection opened and rechecks membership; call it on conversation entry and reconnection in a custom client.

Treat persisted REST history as the source when recovering from a disconnect. A live event updates the open interface but does not replace a history query. Typing notifications are throttled and membership-checked separately.

Mentions, files and verification

@username mentions are resolved against users. Self-mentions and unresolved names are dropped. A resolved mention produces a Notifications integration event; the message itself is saved before the live broadcast. Mention events deliberately use the immediate event bus, so their delivery semantics differ from the durable outbox used by many other module events.

Upload managed attachments using Files and retain their file association. Test two members and a non-member: messages should appear live for the members, remain in history after reload, and remain inaccessible to the non-member. If only live updates fail, inspect authentication, connection recovery and channel joining before changing message storage.

Implementation references

View MarkdownBack to top

Search documentation

Use ↑ ↓ to move, Enter to open and Esc to close.