You will make a chat:* family of channels where signed-in people can join and send, with the last 50 messages kept.

1. Create the channel rule in Studio

  1. Open your project, choose development, then Services → Realtime.
  2. In the sidebar choose Channels (under Configure).
  3. Click Add rule (the page is titled Channel rules).
  4. Pattern: chat:*.
  5. Kind: Presence (tracks who is on the channel as well as messages).
  6. Subscribe policy: Signed-in users. Publish policy: Signed-in users.
  7. Presence: on. History depth: 50.
  8. Save. The rule appears in the list. New rules apply to new connections within about 30 seconds.

2. Try it in the Playground

  1. Choose Playground (under Tools).
  2. Enter chat:lobby as the channel and join it.
  3. Send a message with the event message and a payload like {"text": "hello"}.
You see it arrive, formatted or raw (Formatted / Raw).

3. Do it from your app

Sign a person in (Auth), then:
The message you sent in the Playground appears in your app, and the reverse.

4. See it live in Studio

Go back to Overview: the channel shows under Active channels, your connection under Connections, and the counts of messages published and delivered climb.

What you’ve learned

  • Rules in Studio decide who can join and send.
  • A pattern covers many channels (chat:*).
  • The Playground lets you test without writing code.

Channel rules

Every rule setting.

Channels

Using them in your app.