Skip to content

Real-Time Notifications

While the player is connected, new notifications arrive instantly; perfect for "Deposit Successful" toasts mid-game. Real-time delivery rides the platform's shared real-time channel; this page defines messaging's envelope and fire conditions only.

Connecting & listening

javascript
// 1. Connect the shared channel (after login; see Real-Time Channel)
sdk.messaging.connectRealtime();

// 2. Listen for instant notifications
const unsubscribe = sdk.messaging.onMessage((message) => {
  // message: { eventId, id, type, title, body, occurredAt }
  showToastPopup(message.title, message.body);
});

// 3. Disconnect when logging out
sdk.messaging.disconnectRealtime();

The connection requires an authenticated session; without one it does not open (see the Real-Time Channel reference; one shared connection, ticket authentication, at-least-once delivery with a 24-hour replay window, and eventId dedupe).

Envelope

typescript
interface RealtimeMessage {
  eventId: string;            // dedupe key; see Real-Time Channel
  id: string;                 // the inbox message id this notification persists as
  type: NotificationType;     // 'TRANSACTION' | 'PROMOTION' | 'SYSTEM' | 'SECURITY'
  title: string;
  body: string;
  occurredAt: string;         // ISO-8601; when the notification was generated
}

Fire conditions

text
GIVEN the platform generates a notification for the player
WHEN the notification is created
THEN it is persisted to the inbox (source of truth) AND, if the player
     is connected, delivered in real time with a typed envelope.

GIVEN a notification that fired while the player was disconnected
WHEN the player reconnects within the 24-hour replay window
THEN the notification is redelivered (dedupe by eventId);
     beyond the window, it is still in the inbox; fetch it there.

In-app real-time delivery is not affected by notification preferences; preferences gate outbound channels only (see Messaging Overview).

Sandbox

Sandbox delivers real-time notifications through the channel's in-process emitter; same listener, same envelopes, no network. Controls produce them:

javascript
await sdk.messaging.sandbox.simulateNotification('TRANSACTION', 'Deposit Successful', 'Your deposit of $50 has been credited.');
await sdk.messaging.sandbox.deliverInboxMessage('PROMOTION', 'Weekend Bonus!', 'Get 50 free spins now.');

See Sandbox Controls.

Divergence flag: in sandbox the delivery is synchronous and in-process; the reconnect/replay machinery does not apply (there is no connection to drop).