Sign Up
Loading...

Realtime commands

Use these commands in endpoints, server functions and events to connect authenticated customers and send live notifications. Start with Realtime channels to create a channel and choose its audience.

Authorize Realtime

Issue a one-use connection ticket for the signed-in customer. Call it from a customer-authenticated endpoint, or from a function called by that endpoint. A scheduled event and the editor's Test runner have no customer login and cannot issue a customer's ticket.

Choose channel and set Return as. The result contains ticket, expiresAt, channel and mode. Return it to that customer's app. The ticket expires after 60 seconds and must be sent in the first connection message. Get a new ticket for every new connection; keep it out of connection addresses, logs and shared data.

The Private to each user audience follows the authenticated customer's identity. Clients cannot select a different customer's identity.

Publish Realtime Message

Send a notification using channel, event and data. For a private channel, also provide recipient_id, the destination customer's ID. A shared channel does not accept a private recipient.

For example, after saving an order's new status, publish event order_ready with data containing the order ID and status. Send it to the order owner's customer ID when using a private channel.

The result is true after submission. It is not a delivery receipt. Disconnected apps do not receive past messages, so save important changes in the database and reload them when reconnecting.

Testing and limits

For a full connection check, sign in with a synthetic customer in your Dev workspace and call its authenticated API endpoint. The editor's Test runner cannot issue tickets. Publish commands from editor tests use a separate audience and cannot reach customers connected to real API calls. Messages must fit within 64 KiB including event details. A workspace allows up to 120 publish attempts per minute and a customer up to 20 ticket requests per minute.

These commands run in server workflows. They do not let an app publish directly through its receiving connection. Channel settings and the customer's current permissions are checked before access is granted.

Related Topics

Process PDF files

Inspect a PDF, combine documents, copy selected pages into a separate file, or read existing text. Find PDF information, Merge PDFs, Select PDF pages and Extract PDF text under File Manager when adding a command to a server workflow. Use a file containing its contents. Choose an uploaded file, an ea...

XML commands

Use XML commands when a service sends or expects XML documents. They work with the same variable controls as other commands. Parse XML. Add Parse XML, supply the XML text and choose a mode. SIMPLE is convenient when you need fields from a straightforward document. ORDERED preserves the order of elem...

Conversion

Overview. Twidget's conversion commands allow you to easily convert different data types to the required format. Below is a list of the available conversion commands and examples of how to use them. The `Convert to Text` command converts the provided value to a text (string) format. Examples: - `123...

Advanced file commands

Prepare CSV downloads, work with small ZIP archives and share a temporary download link from an endpoint, server function or event. Find these commands under File Manager when adding a command. Use the usual variable selector and Return as field. The existing file commands still handle storage, fold...

Cache

Cache values let an endpoint, server function or event reuse temporary data. For example, save a product summary for five minutes instead of requesting it from another service every time. A cache is temporary. Keep permanent records in your database and make sure the workflow can obtain the original...