Developers API
Realtime Event Engine
WebSocket streaming, event webhooks, payload schemas, rule conditions, delivery lifecycle, signature verification, event history, and errors.
WebSocket Streaming
Real-time stock price streaming via WebSocket, with market updates pushed as soon as they change.
WebSocket URL:
text
wss://app.sahmk.sa/ws/v1/stocks/?api_key=YOUR_API_KEYAvailability: WebSocket streaming requires Pro, Business, or Enterprise plans.
Subscription Limits
| Plan | Max symbols/connection | Max symbols/call | Subscribe all (*) |
|---|---|---|---|
| Pro | 60 | 20 | No |
| Business | 120 | 40 | No |
| Enterprise | 200 | 20 (or 100 on enterprise profile) | Yes |
Client -> Server Messages
| Action | Message | Description |
|---|---|---|
| Subscribe | {"action":"subscribe","symbols":["2222","1120"]} | Subscribe to specific symbols |
| Subscribe All | {"action":"subscribe","symbols":["*"]} | Enterprise-only full market subscription |
| Unsubscribe | {"action":"unsubscribe","symbols":["2222"]} | Stop updates for selected symbols |
| Ping | {"action":"ping"} | Keep-alive probe |
Server -> Client Message Types
connectedsubscribedunsubscribedquotepongerrorNo required ping interval is published. Clients may send ping and receive pong.
Per-call limits can vary by plan profile. Use limits returned in the connected message for your account.