Users
get WS URl
This APi provide the endpoint and other details to connect to websocket to fetch realtime updates.
Get WS URL
Type | Endpoint | Description |
---|---|---|
GET | /auth/ws-url/ | Get Websocket URL |
Get websocket URL
Get the user profile information.
Request
curl --location --request GET 'https://{BASEURL}broking/api/v0/auth/ws-url/
--header 'access-token: access-token' \
--header 'Content-Type: application/json' \
--data-raw ''
Response In Success response, we get the details of websocket endpoint. If HTTP status code is received in response like 4xx or 5xx, this means failure or exceptions.
{
"base_url": "ws://{rootUrl}/NorenWSWeb/",
"body": {
"t": "c",
"uid": "INV31",
"actid": "INV31",
"source": "API",
"susertoken": "e7ab724cac89f0b82b1616ebf0d5214d697d4b5771af2f361c775aa7b5f01e45"
}
}
response attributes
Field | Field type | Description |
---|---|---|
base_url | string | websocket endpoint |
t | string | "c" means connect |
uid | string | UserId or CRN no |
actid | string | accountId or CRN no |
source | string | source of connection |
susertoken | sting | token for authenticating websocket connection |
Websocket Connection
Steps for creating websocket connection
- step1: connect to websocket create a websokcet connection from the payload received from get Websocket URL API. The payload consist of base_url which is the websocket endpoint. connect to websocket endpoint provided
- step2: Authenticate send authentication request with payload provided in get websocket URL API .
- step3: Subscribe subscribe the websocket for various message type. the various message types available for subscribing are following
Field | Description |
---|---|
marketwatch | Marketwatch data |
snapQuote | snapquote data |
orders | order update |
Authorization
request payload:
{
"t": "c",
"uid": "ADI634",
"actid": "ADI634",
"source": "API",
"susertoken": "098cc8daba5886bd1791e743e346f116ec15deefb5d7528f0b122e2b2d23ffe2"
}
Response payload
the message to be sent to websocket for authorization is payload recived from get websocket URL API. On succesfull authentication, websocket received the followinge message
{"t":"ck","s":"OK"}
response attribute
Field | Field type | Description |
---|---|---|
t | string | ck-> connection acknowledgement |
s | string | status |
Subscribe feeds & order update
user could subscribe market watch data by sending the following mesage to web websocket request payload:
{
"t":"t",
"k":"NFO|56274#BSE|508123#BSE|SENSEX"
}
Request parameters
Field | Field type | Description |
---|---|---|
t | string | subscription type. see details |
k | string | exchange Segment |
Response payload On succesfull subscription, websocket received the followinge message
{"t":"tk","s":"OK"}
response attribute
Field | Field type | Description |
---|---|---|
t | string | tk-> touchline subscription acknowledgement |
s | string | status |
and then further updates of feeds for the subscribed exchanges.