Skip to main content
Improved formatting
Source Link
Martin Evans
  • 46.9k
  • 17
  • 88
  • 104

This worked for me  , I I used this WebSocket client library https://github.com/TakahikoKawasaki/nv-websocket-clientWebSocket client library  . 

You need to send OAUTH token via the Websocket Header, Below is the code, hope this is helpful.

ws = factory.createSocket("wss://yourcompleteendpointURL/");
ws.addHeader("Authorization", "Bearer <yourOAUTHtoken>");
ws.addHeader("Upgrade", "websocket");
ws.addHeader("Connection", "Upgrade");
ws.addHeader("Host", "<YourhostURLasabovegiveupto.com>");
ws.addHeader("Sec-WebSocket-Key", "<Somerandomkey>");
ws.addHeader("Sec-WebSocket-Version", "13");
ws.connect();

This worked for me  , I used this WebSocket client library https://github.com/TakahikoKawasaki/nv-websocket-client  . You need to send OAUTH token via the Websocket Header, Below is the code, hope this is helpful.

ws = factory.createSocket("wss://yourcompleteendpointURL/");
ws.addHeader("Authorization", "Bearer <yourOAUTHtoken>");
ws.addHeader("Upgrade", "websocket");
ws.addHeader("Connection", "Upgrade");
ws.addHeader("Host", "<YourhostURLasabovegiveupto.com>");
ws.addHeader("Sec-WebSocket-Key", "<Somerandomkey>");
ws.addHeader("Sec-WebSocket-Version", "13");
ws.connect();

This worked for me, I used this WebSocket client library. 

You need to send OAUTH token via the Websocket Header, Below is the code, hope this is helpful.

ws = factory.createSocket("wss://yourcompleteendpointURL/");
ws.addHeader("Authorization", "Bearer <yourOAUTHtoken>");
ws.addHeader("Upgrade", "websocket");
ws.addHeader("Connection", "Upgrade");
ws.addHeader("Host", "<YourhostURLasabovegiveupto.com>");
ws.addHeader("Sec-WebSocket-Key", "<Somerandomkey>");
ws.addHeader("Sec-WebSocket-Version", "13");
ws.connect();

This worked for me , I used this WebSocket client library https://github.com/TakahikoKawasaki/nv-websocket-client . You need to send OAUTH token via the Websocket Header, Below is the code, hope this is helpful.

ws = factory.createSocket("wss://yourcompleteendpointURL/");

ws.addHeader("Authorization", "Bearer ");

ws.addHeader("Upgrade", "websocket");

ws.addHeader("Connection", "Upgrade");

ws.addHeader("Host", "<YourhostURLasabovegiveupto.com>");

ws.addHeader("Sec-WebSocket-Key", ""); ws.addHeader("Sec-WebSocket-Version", "13");

ws.connect();

ws = factory.createSocket("wss://yourcompleteendpointURL/");
ws.addHeader("Authorization", "Bearer <yourOAUTHtoken>");
ws.addHeader("Upgrade", "websocket");
ws.addHeader("Connection", "Upgrade");
ws.addHeader("Host", "<YourhostURLasabovegiveupto.com>");
ws.addHeader("Sec-WebSocket-Key", "<Somerandomkey>");
ws.addHeader("Sec-WebSocket-Version", "13");
ws.connect();

This worked for me , I used this WebSocket client library https://github.com/TakahikoKawasaki/nv-websocket-client . You need to send OAUTH token via the Websocket Header, Below is the code, hope this is helpful.

ws = factory.createSocket("wss://yourcompleteendpointURL/");

ws.addHeader("Authorization", "Bearer ");

ws.addHeader("Upgrade", "websocket");

ws.addHeader("Connection", "Upgrade");

ws.addHeader("Host", "<YourhostURLasabovegiveupto.com>");

ws.addHeader("Sec-WebSocket-Key", ""); ws.addHeader("Sec-WebSocket-Version", "13");

ws.connect();

This worked for me , I used this WebSocket client library https://github.com/TakahikoKawasaki/nv-websocket-client . You need to send OAUTH token via the Websocket Header, Below is the code, hope this is helpful.

ws = factory.createSocket("wss://yourcompleteendpointURL/");
ws.addHeader("Authorization", "Bearer <yourOAUTHtoken>");
ws.addHeader("Upgrade", "websocket");
ws.addHeader("Connection", "Upgrade");
ws.addHeader("Host", "<YourhostURLasabovegiveupto.com>");
ws.addHeader("Sec-WebSocket-Key", "<Somerandomkey>");
ws.addHeader("Sec-WebSocket-Version", "13");
ws.connect();
Source Link

This worked for me , I used this WebSocket client library https://github.com/TakahikoKawasaki/nv-websocket-client . You need to send OAUTH token via the Websocket Header, Below is the code, hope this is helpful.

ws = factory.createSocket("wss://yourcompleteendpointURL/");

ws.addHeader("Authorization", "Bearer ");

ws.addHeader("Upgrade", "websocket");

ws.addHeader("Connection", "Upgrade");

ws.addHeader("Host", "<YourhostURLasabovegiveupto.com>");

ws.addHeader("Sec-WebSocket-Key", ""); ws.addHeader("Sec-WebSocket-Version", "13");

ws.connect();