All documentation
Reference

SDK 0.2.0 Production Behaviour and Errors

Understand defaults, retries, timeouts, reconnects, heartbeat, queues and the typed errors added in PulseGrid 0.2.0.

Multi-language

Overview

PulseGrid 0.2.0 is designed to behave predictably in production rather than only succeeding on perfect local networks. Important 0.2.0 behavior includes: - production default base URL - request timeout handling - retry support for safe operations - typed/structured SDK errors - realtime reconnect with exponential backoff - automatic heartbeat - outgoing realtime queue while disconnected - token refresh callbacks in the browser client - idempotency support for Push sends - webhook signature helpers - doctor diagnostics

Setup

Application guidance: 1. Catch SDK errors at your application boundary and log code/status, not secrets. 2. Show users a meaningful application message rather than raw stack traces. 3. Let the SDK perform its built-in safe retry/reconnect behavior. 4. Use idempotency for business actions that must not duplicate. 5. Keep reconnect/heartbeat telemetry separate from business events. 6. Use Activity/observability tooling to record success and failure without recursively serializing live socket objects.

Code example

SDK 0.2.0 Production Behaviour and Errors
JavaScript
try {
  await pg.channel("orders").publish("Order ready");
} catch (error) {
  console.error({
    name: error.name,
    code: error.code,
    status: error.status,
    message: error.message,
  });
}

Notes

Do not serialize an entire live connection/socket object into JSON for activity logs; socket objects can contain circular references. Record safe fields such as connection type, state, channel and timestamps instead.