Problem in conencting to websocket client getting 405 bad request error

Hi All, i am getting 405 bad request error while conencting to websocket from Javascript client.I am using like this:

var ticker = new KiteTicker({api_key: API_SECRET,access_token: API_TOKEN});

ticker.on("tick", this.onTick(ticker));
ticker.on("connect", this.onConnect(ticker));

And getting 405 bad request error.

I have read that i have to add authorization header.

Please help me with a sample code to connect to websocket from client.
  • rakeshr
    Instead of KiteTicket, it should be WebSocket.You can have look to this document.
  • ashu3889
    Can you please send me a sample code for websocket connect? i have trouble connecting it
  • rakeshr
    It's given in above link.
    // Javascript example.
    var ws = new WebSocket("wss://");
    // Subscribe to quotes for INFY (408065) and TATAMOTORS (884737)
    var message = {"a": "subscribe", "v": [408065, 884737]};
  • ashu3889
    Thanks for help... While connecting to websocket from client i am getting 101 Switching Protocols and request is not completed. Please help
  • ashu3889
    Hi Rakesh, after connecting to websocket i am getting data as istrusted: true.. please tell me how will i get the data of quote. thanks for help
Sign In or Register to comment.