Getting "Invalid JSON message" error while connect with websocket.

V2R
Hi,

I am using below code for connecting websocket with API.
Its giving me error message "Invalid JSON message". Please suggest if anything wrong in code.

var conn = new WebSocket('wss://ws.kite.trade?api_key=XXXXX&access_token=XXXXXXX');
conn.onmessage = function(e){ console.log(e.data); };
conn.onopen = () => conn.send('hello');
Tagged:
Sign In or Register to comment.