Skip to content

PAM Native Realtime

Every PAM Native product runs on the PAM runtime. Install and verify PAM first, create a Native application, and add this package through PAM Composer:

Terminal window
curl -fsSL https://github.com/push-in/pam/releases/latest/download/install.sh | sh
pam doctor
pam init my-app --template native
cd my-app
pam composer require pushinbr/pam-native-realtime
pam doctor
pam native dev
$realtime = new Realtime();
$realtime->connect(
'wss://api.example.com/socket',
['Authorization' => 'Bearer '.$token],
['pam.v1'],
fn (?string $id, ?string $error) => null,
);
$realtime->poll($id, fn (?RealtimeEvent $event, ?string $error) => null);

Realtime connects, sends text/binary, polls, inspects state, and closes; RealtimeEvent/RealtimeEventKind normalize messages/lifecycle/timeouts; RealtimeConnectionState types connection state.

Only authenticated wss:// is accepted. Frames are bounded per connection; incoming events use a 256-item native queue and one pending long poll. Poll continuously, treat timeout as a lifecycle tick, refresh credentials as needed, and reconnect with bounded jitter. Android uses OkHttp 5.3.0; iOS uses URLSessionWebSocketTask.

RealtimePluginProvider registers the transport automatically.