Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Websocket error "Error observed : {"isTrusted":true}"

    Bugs
    0
    1
    3
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      pankaj8932 last edited by

      Hi,

      I am trying to create websocket connection using java script but it gives this error. I used below url format to connect the server where I have replaced variables with actual value. I am able to get profile information using simple get profile api call but websocket connect doesn't work.

      It says failed to connect and gives this error "Error observed : {"isTrusted":true}" Can anybody please help me here?
      My client Id : P51757

      let NEW_URL = "wss://smartapisocket.angelbroking.com/websocket?jwttoken=" + JWT_TOKEN + "&&clientcode=" + FEED_TOKEN + "&&clientcode=" +CLIENT_CODE+ "&&apikey=" +API_KEY + "&&feedType=" + FEED_TYPE
      let websocketObj = new WebSocket(NEW_URL);
      websocketObj.onopen = function() {
                  let strwatchlistscrips = "nse_cm|2885&nse_cm|1594&nse_cm|11536";
                  var _watchReq = '{"task":"mw","channel":"' + strwatchlistscrips + '","token":"' + FEED_TOKEN + '","user": "' + CLIENT_CODE + '","acctid":"' + CLIENT_CODE + '"}'; 
                  console.log('connection req : ' + _watchReq);
                  websocketObj. send(_watchReq);
                  console.log('socket opened.')
              }
      websocketObj.onerror = function(error) {
                  console.log('Error observed : ' + JSON.stringify(error));
                };
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post