WIP cli tests for rpc
This commit is contained in:
@@ -24,13 +24,15 @@ var createNetwork = Client.createNetwork = function (url, cb) {
|
||||
var info = {};
|
||||
|
||||
Netflux.connect(url, function (url) {
|
||||
// this websocket seems to never close properly if the error is
|
||||
// ECONNREFUSED
|
||||
info.websocket = new WebSocket(url)
|
||||
.on('error', function (err) {
|
||||
console.log(err);
|
||||
CB(err);
|
||||
})
|
||||
.on('close', function (err) {
|
||||
console.log("close");
|
||||
console.log(err);
|
||||
console.log("CLOSE_ERROR", err);
|
||||
delete info.websocket;
|
||||
});
|
||||
return info.websocket;
|
||||
}).then(function (network) {
|
||||
@@ -77,7 +79,10 @@ Client.create = function (config, cb) {
|
||||
if (config.network) { return; }
|
||||
// connect to the network...
|
||||
createNetwork('ws://localhost:3000/cryptpad_websocket', w(function (err, info) {
|
||||
//console.log(_network);
|
||||
if (err) {
|
||||
w.abort();
|
||||
return void CB(err);
|
||||
}
|
||||
config.network = info.network;
|
||||
config.websocket = info.websocket;
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user