Getting Started
Introduction
- The WebSocket serves as an advanced technology that enables the establishment of a bi-directional communication channel between a user's browser and a server. Through this, users can seamlessly send messages to a server and receive responses driven by events, eliminating the need for continuous polling of the server for replies.
- With the WebSocket, users gain the capability to access real-time quotes for all scripts across various Indian Exchanges during market hours. These data feeds are broadly classified into three categories: Market Feed ,OrderUpdate Feed and PositionUpdate Feed. Upon initiating a new connection, users can anticipate receiving an acknowledgment for successful connection establishment.
Create Session
- Copy the susertoken from the login API
Connection String
Create Connection to Websocket using the following URL:
wss://socket.firstock.in/ws
Send the Following Data in the query params of Websockets
Field | Type | Mandatory | Description | Example |
---|---|---|---|---|
userId |
string |
Yes |
UserId of the client |
AB1234 |
jKey |
string |
Yes |
susertoken from the Login API |
5763be188551a9da7bab9e0351a2004fea0a4042a8845b48b66ee2415556bf6 |
source |
string |
Yes |
Source of the websocket |
developer-api |
Response Structure
Success Response
If the credentials and API key are valid, you will receive a 200 OK status with a JSON response containing the following fields:
- status: Indicates a successful request (e.g., "success").
- message: Provides a short description of the outcome (e.g., "Authentication successful").
Failure Response
If any required fields are missing or invalid, you will receive a 401 status code with a structure like:
- status: Typically "failed".
- messafe: Provides a short description of the outcome (e.g., "Aunauthenticated").
Response
200
401
{"status":"success","message":"Authentication successful"}
{"status":"failed","message":"unauthenticated"}