Last active
April 17, 2017 17:05
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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