Automation and events
Realtime
Realtime — Micro TypeScript reference.
Reference for TypeScript SDK 0.14.0.
Release source · Setup and client configuration
createTicket
POST /v2/realtime/ticket
client.realtime.createTicket() -> RealtimeCreateTicketResponseExchange your API key (or session) for a short-lived ticket that authenticates a
connection to the realtime object-change stream. Open a WebSocket to the push
endpoint with the returned ticket as the token query parameter. The ticket is
single-purpose and expires quickly; call this again to obtain a fresh one before
reconnecting.
Parameter and response types
These declarations show the request parameters and response shapes used by the methods above.
RealtimeCreateTicketResponse
export interface RealtimeCreateTicketResponse {
/**
* Seconds until the ticket expires. Refresh (call the endpoint again) before
* reconnecting.
*/
expires_in: number;
/**
* Short-lived token authenticating a realtime WebSocket connection. Pass as the
* `token` query parameter when connecting.
*/
ticket: string;
/**
* WebSocket URL for this environment (wss://stream.developers[.staging].micro.so).
* Connect here with the ticket as the `token` query parameter.
*/
ws_url: string | null;
}Realtime
export declare namespace Realtime {
export { type RealtimeCreateTicketResponse as RealtimeCreateTicketResponse };
}