WebSocket for getting Market dat


  • Did any one try getting market data via websocket? I am getting error while trying to use the example code given in SmartAPITicker.java

    Can someone confirm if the java is supported for websocket?

    onTextMessage Message received...
    eJyLrlZKzFayUsrPVtJRKkksBrFzy4Hs3OJ0CLM2FgDEIQq3
    at org.json.JSONTokener.syntaxError(JSONTokener.java:505)
    at org.json.JSONObject.<init>(JSONObject.java:214)
    at org.json.JSONObject.<init>(JSONObject.java:357)
    at com.angelbroking.smartapi.ticker.SmartAPITicker.parseTextMessage(SmartAPITicker.java:775)
    at com.angelbroking.smartapi.ticker.SmartAPITicker.access$9(SmartAPITicker.java:771)
    at com.angelbroking.smartapi.ticker.SmartAPITicker$3.onTextMessage(SmartAPITicker.java:306)
    at com.neovisionaries.ws.client.ListenerManager.callOnTextMessage(ListenerManager.java:352)


  • Hi @rahulmyzone Team is working on it we will update here.


  • @kripabhat I am getting the same issue. If this is fixed for you let me know the fix.


  • @admin Thanks for the fix. I am yet to check the latest code, will check and let you know if any further issue found.


  • Hi @kripabhat , we have fixed the issue. Please refer latest Java SDK repository.


  • @admin Please let me know when the fix will be available?


  • @admin Ok thanks, let me know once the fix is available


  • Hi @kripabhat , team has identified an issue. Will let you know once the issue is fixed.


  • @admin Below is some more details,

    I am sending correct message(subscription) to WebSocket after opening connection.
    ws.sendText("{ "task":"cn","channel":"","token":""+feedToken+"","user":"<ClientCode>","acctid":"<ClientCode>" }");
    ws.sendText("{"task":"mw","channel":"nse_cm|3045","token":""+feedToken+"","user":"<ClientCode>","acctid":"<ClientCode>"}");

    Once after sending the above message then below text message is received continuously,. Looks like issue with conversion of message??
    WebSocket Connection Status=true
    onTextMessage
    eJyLrlYqKUvMKU1VslIyNI3RNzSK0TcyMDJQMDS0MjK0MjVW0lHKS8wFSZfkKtXqVCuBmHnFqfHJuQip4jQgO6ekAMg0MrPUMzcAcwtBZoKYJdlAlrGBiSlYuATI8XNUqo0FAB9nIH4=


  • We have raised your query to our development team, will keep you posted. @kripabhat


  • @kripabhat said in WebSocket for getting Market dat:

    Did any one try getting market data via websocket? I am getting error while trying to use the example code given in SmartAPITicker.java

    Can someone confirm if the java is supported for websocket?

    onTextMessage Message received...
    eJyLrlZKzFayUsrPVtJRKkksBrFzy4Hs3OJ0CLM2FgDEIQq3
    at org.json.JSONTokener.syntaxError(JSONTokener.java:505)
    at org.json.JSONObject.<init>(JSONObject.java:214)
    at org.json.JSONObject.<init>(JSONObject.java:357)
    at com.angelbroking.smartapi.ticker.SmartAPITicker.parseTextMessage(SmartAPITicker.java:775)
    at com.angelbroking.smartapi.ticker.SmartAPITicker.access$9(SmartAPITicker.java:771)
    at com.angelbroking.smartapi.ticker.SmartAPITicker$3.onTextMessage(SmartAPITicker.java:306)
    at com.neovisionaries.ws.client.ListenerManager.callOnTextMessage(ListenerManager.java:352)

    @bhaveshjain, please confirm Java SDK supports websocket streaming of market data