WebSocket

Real-time streaming for account changes, transaction logs, and slot updates.

Endpoint: wss://rpc.nodius.xyz/ws
Auth: Authorization: Bearer TOKEN header or Sec-WebSocket-Protocol: auth.TOKEN
Min balance: 100 credits to connect. Auto-disconnect below 10 credits.

Connecting

TypeScript
Raw WebSocket
import { NodiusClient } from "@nodius/sdk";

const rpc = new NodiusClient({
  endpoint: "https://rpc.nodius.xyz",
  keypair,
  auth: "session",
});

const subId = await rpc.ws.accountSubscribe(
  "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
  { encoding: "base64", commitment: "confirmed" },
  (notification) => console.log(notification)
);
const ws = new WebSocket("wss://rpc.nodius.xyz/ws", {
  headers: { Authorization: "Bearer YOUR_TOKEN" }
});

// Or for browser clients:
const ws = new WebSocket(
  "wss://rpc.nodius.xyz/ws",
  ["auth.YOUR_TOKEN"]
);

Subscription Methods

MethodDescriptionTier
accountSubscribeMonitor specific account data changesAll
logsSubscribeTransaction logs (all or filtered by pubkey)All
programSubscribeAll accounts owned by a programAll
signatureSubscribeTransaction confirmation (auto-unsubscribes)All
slotSubscribeSlot number updates (~400ms)All
rootSubscribeFinalized root slot updatesAll
blockSubscribeFull block data streamingPerformance

Example: Subscribe to Account Changes

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountSubscribe",
  "params": [
    "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
    { "encoding": "base64", "commitment": "confirmed" }
  ]
}
// Response: { "jsonrpc": "2.0", "result": 42, "id": 1 }
// 42 is your subscription ID — use it to unsubscribe

Example: Filter Logs by Program

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "logsSubscribe",
  "params": [
    { "mentions": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"] },
    { "commitment": "confirmed" }
  ]
}

Credit Costs

ActionCredits
Subscribe5 per subscription
Notification received1 per notification
Unsubscribe / Connect0

Estimated Hourly Costs

Subscription~Credits/Hour
slotSubscribe~9,000
signatureSubscribe~6 (one-time)
logsSubscribe (all)10,000+
programSubscribe (Token Program)100,000+

Subscription Limits

TierMax Subscriptions
Standard10 concurrent
Performance50 concurrent

Exceeding the limit returns: {"error":{"code":-32000,"message":"Subscription limit reached (10/10)"}}

Close Codes

CodeReasonDescription
1008policy_violationInvalid or expired token
4001auth_failedAuthentication failed
4002insufficient_creditsBalance dropped below 10 credits
4003rate_limitedMessage frequency too high

Best Practices