You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
802 B
32 lines
802 B
var WebSocket = require('..').Client,
|
|
deflate = require('permessage-deflate'),
|
|
fs = require('fs');
|
|
|
|
var url = process.argv[2],
|
|
proxy = process.argv[3],
|
|
ca = fs.readFileSync(__dirname + '/../spec/server.crt'),
|
|
tls = {ca: ca};
|
|
|
|
var ws = new WebSocket(url, [], {
|
|
proxy: {origin: proxy, headers: {'User-Agent': 'Echo'}, tls: tls},
|
|
tls: tls,
|
|
headers: {Origin: 'http://faye.jcoglan.com'},
|
|
extensions: [deflate]
|
|
});
|
|
|
|
ws.onopen = function() {
|
|
console.log('[open]', ws.headers);
|
|
ws.send('mic check');
|
|
};
|
|
|
|
ws.onclose = function(close) {
|
|
console.log('[close]', close.code, close.reason);
|
|
};
|
|
|
|
ws.onerror = function(error) {
|
|
console.log('[error]', error.message);
|
|
};
|
|
|
|
ws.onmessage = function(message) {
|
|
console.log('[message]', message.data);
|
|
};
|
|
|