Skip to content

Stream Notifications

Notifications are sent automatically to all connected clients (no subscription required).

They are used for: - Trade execution confirmations - Margin call / Stop-out warnings - System messages - Custom alerts

Outgoing Message Format

Sent as a JSON array:

Index Field Type Description
0 "n" string Event marker
1 message string Short title
2 description string Detailed text (supports placeholders like {order}, {price})
3 token string Unique token for deduplication
4 status int Delivery status (0 = waiting, 1 = sent, 2 = read, etc.)
5 level int Importance level (10=INFO, 20=WARNING, 30=ERROR, 40=PROMO, …)
6 user_id int Recipient login (0 = broadcast)
7 create_time int Unix timestamp
8 data (optional) object / null Structured data (if valid JSON in NotifyRecord.data)
9 code int Result code (200 = success, 400 = client error, 500 = server error, etc.)

Example (with data object)

[
  "n",
  "Order opened",
  "Your order {order} has been opened at price {price}",
  "token-abc123",
  1,
  20,
  100500,
  1734312345,
  {
    "order": 58123,
    "symbol": "EURUSD",
    "volume": 0.1,
    "price": 1.08952
  },
  201
]

Example (without data object)

[
  "n",
  "Margin Call",
  "Your margin level dropped below critical threshold",
  "mc-xyz987",
  1,
  30,
  100500,
  1734312400,
  400
]

Level values

Value Meaning
10 INFO
20 WARNING
30 ERROR
40 PROMO
50 MARKETING
60 NEWS
```

Client parsing tips

  • Always check arr[0] === "n"
  • If arr[8] is an object → structured data, code is arr[9]
  • If arr[8] is a number → code is arr[8], no data object