Skip to content

Instantly share code, notes, and snippets.

@TPXP
Last active April 17, 2017 17:05
Show Gist options
  • Save TPXP/6dda139332e1956a0ce42f774d9d61f4 to your computer and use it in GitHub Desktop.
Save TPXP/6dda139332e1956a0ce42f774d9d61f4 to your computer and use it in GitHub Desktop.
A simple test case to show a bug with connecting to secure servers when using an old version of faye-websocket
{
"name": "websocket-bug",
"version": "0.0.1",
"description": "A simple test case to show a bug with connecting to secure servers while using an old version of faye-websocket",
"main": "test.js",
"dependencies": {
"faye-websocket": "^0.9.4"
},
"devDependencies": {},
"scripts": {
"test": "node test.js"
},
"author": "TPXP",
"license": "MIT"
}
// Shameful copy and adaptation of the example code of the official faye-websocket github repo
var WebSocket = require('faye-websocket'),
ws = new WebSocket.Client('wss://packages.meteor.com/websocket');
ws.on('open', function(event) {
console.log('open');
ws.send('Hello, world!');
});
ws.on('message', function(event) {
console.log('message', event.data);
});
ws.on('error', function(event) {
console.log('error', event.message);
});
ws.on('close', function(event) {
console.log('close', event.code, event.reason);
ws = null;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment