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
try {
await pg.channel("orders").publish("Order ready");
} catch (error) {
console.error({
name: error.name,
code: error.code,
status: error.status,
message: error.message,
});
}
try:
pg.channel("orders").publish("Order ready")
except Exception as exc:
print(type(exc).__name__, getattr(exc, "code", None), str(exc))
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.