Add WebSocket Secure (SSL) support to client library.

This commit is contained in:
Stefan Thomas
2012-12-06 14:10:26 -08:00
parent 73db82ac56
commit 10e53b7562
2 changed files with 4 additions and 1 deletions

View File

@@ -191,6 +191,7 @@ var Remote = function (opts, trace) {
this.trusted = opts.trusted; this.trusted = opts.trusted;
this.websocket_ip = opts.websocket_ip; this.websocket_ip = opts.websocket_ip;
this.websocket_port = opts.websocket_port; this.websocket_port = opts.websocket_port;
this.websocket_ssl = opts.websocket_ssl;
this.local_sequence = opts.local_sequence; // Locally track sequence numbers this.local_sequence = opts.local_sequence; // Locally track sequence numbers
this.local_fee = opts.local_fee; // Locally set fees this.local_fee = opts.local_fee; // Locally set fees
this.id = 0; this.id = 0;
@@ -384,7 +385,8 @@ Remote.prototype._connect_start = function () {
// with self-signed certs as the user must have pre-approved the self-signed certs. // with self-signed certs as the user must have pre-approved the self-signed certs.
var self = this; var self = this;
var url = "ws://" + this.websocket_ip + ":" + this.websocket_port; var url = (this.websocket_ssl ? "wss://" : "ws://") +
this.websocket_ip + ":" + this.websocket_port;
if (this.trace) console.log("remote: connect: %s", url); if (this.trace) console.log("remote: connect: %s", url);

View File

@@ -23,6 +23,7 @@ exports.servers = {
'rpc_port' : 5005, 'rpc_port' : 5005,
'websocket_ip' : "127.0.0.1", 'websocket_ip' : "127.0.0.1",
'websocket_port' : 5006, 'websocket_port' : 5006,
'websocket_ssl' : false,
'local_sequence' : true, 'local_sequence' : true,
'local_fee' : true, 'local_fee' : true,
// 'validation_seed' : "shhDFVsmS2GSu5vUyZSPXYfj1r79h", // 'validation_seed' : "shhDFVsmS2GSu5vUyZSPXYfj1r79h",