Skip to main content

Users

get WS URl

This APi provide the endpoint and other details to connect to websocket to fetch realtime updates.

Get WS URL

TypeEndpointDescription
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
FieldField typeDescription
base_urlstringwebsocket endpoint
tstring"c" means connect
uidstringUserId or CRN no
actidstringaccountId or CRN no
sourcestringsource of connection
susertokenstingtoken for authenticating websocket connection

Websocket Connection

Steps for creating websocket connection

  1. 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
  2. step2: Authenticate send authentication request with payload provided in get websocket URL API .
  3. step3: Subscribe subscribe the websocket for various message type. the various message types available for subscribing are following
FieldDescription
marketwatchMarketwatch data
snapQuotesnapquote data
ordersorder 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

FieldField typeDescription
tstringck-> connection acknowledgement
sstringstatus

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

FieldField typeDescription
tstringsubscription type. see details
kstringexchange Segment

Response payload On succesfull subscription, websocket received the followinge message

{"t":"tk","s":"OK"}

response attribute

FieldField typeDescription
tstringtk-> touchline subscription acknowledgement
sstringstatus

and then further updates of feeds for the subscribed exchanges.