drishti-sdk 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -202,6 +202,73 @@ Direct import is also supported:
|
|
|
202
202
|
import { DrishtiWebSocketSession } from "drishti-sdk";
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
+
### WebSocket Reference
|
|
206
|
+
|
|
207
|
+
The WebSocket session is created from the HTTP client, so it inherits the same
|
|
208
|
+
`apiKey`, `baseUrl`, and extra headers. In Node and other environments that
|
|
209
|
+
support custom WebSocket headers, the client sends `X-API-Key`. In browser-like
|
|
210
|
+
constructors that do not allow headers, the SDK falls back to
|
|
211
|
+
`?api_key=...` automatically.
|
|
212
|
+
|
|
213
|
+
Supported subscription products:
|
|
214
|
+
|
|
215
|
+
- `news`
|
|
216
|
+
- `announcements`
|
|
217
|
+
- `earnings`
|
|
218
|
+
- `concalls`
|
|
219
|
+
- `alerts`
|
|
220
|
+
|
|
221
|
+
Useful session options:
|
|
222
|
+
|
|
223
|
+
- `autoReconnect`
|
|
224
|
+
- `reconnectInitialDelayMs`
|
|
225
|
+
- `reconnectMaxDelayMs`
|
|
226
|
+
- `reconnectBackoffMultiplier`
|
|
227
|
+
- `reconnectJitterRatio`
|
|
228
|
+
- `onSubscribed`
|
|
229
|
+
- `onData`
|
|
230
|
+
- `onError`
|
|
231
|
+
- `onMessage`
|
|
232
|
+
- `onOpen`
|
|
233
|
+
- `onClose`
|
|
234
|
+
- `onReconnectAttempt`
|
|
235
|
+
|
|
236
|
+
Subscription messages accept an object shaped like
|
|
237
|
+
`{ product, symbols?, detailed? }`. Symbols are normalized to uppercase and
|
|
238
|
+
de-duplicated before the message is sent. When auto reconnect is enabled, the
|
|
239
|
+
session re-subscribes after reconnecting.
|
|
240
|
+
|
|
241
|
+
Event shapes:
|
|
242
|
+
|
|
243
|
+
- `subscribed`: acknowledgement with `product`, `tier`, `fullFeed`,
|
|
244
|
+
`symbols`, and `detailed`
|
|
245
|
+
- `data`: payload event with `channel` and `data`
|
|
246
|
+
- `error`: error event with `message` and optional `code`
|
|
247
|
+
- `raw`: unclassified JSON payload
|
|
248
|
+
|
|
249
|
+
Direct helpers exported from the package:
|
|
250
|
+
|
|
251
|
+
- `DRISHTI_WS_PRODUCTS`
|
|
252
|
+
- `DrishtiWebSocketSession`
|
|
253
|
+
- `buildWebSocketUrl`
|
|
254
|
+
- `parseWebSocketMessage`
|
|
255
|
+
- `streamProduct`
|
|
256
|
+
- `SubscribeOptions`
|
|
257
|
+
- `DataEvent`
|
|
258
|
+
- `ErrorEvent`
|
|
259
|
+
- `RawEvent`
|
|
260
|
+
- `SubscribedEvent`
|
|
261
|
+
- `WebSocketEvent`
|
|
262
|
+
- `WebSocketHandler`
|
|
263
|
+
|
|
264
|
+
`DataEvent["data"]` is typed by channel for the known products:
|
|
265
|
+
|
|
266
|
+
- `news` -> `NewsItem`
|
|
267
|
+
- `announcements` -> `AnnouncementDetail | AnnouncementListItem`
|
|
268
|
+
- `earnings` -> `EarningsDetail | EarningsListItem`
|
|
269
|
+
- `concalls` -> `Concall | ConcallListItem`
|
|
270
|
+
- `alerts` -> `Alert`
|
|
271
|
+
|
|
205
272
|
## Batch Jobs
|
|
206
273
|
|
|
207
274
|
Upload JSONL files for batch processing:
|