Use socket.io instead of WebSocket

pull/1/head
yflory 7 years ago
parent b0311ccec1
commit 9195c57445

@ -11,6 +11,7 @@
"pull-stream": "^3.6.1", "pull-stream": "^3.6.1",
"replify": "^1.2.0", "replify": "^1.2.0",
"saferphore": "0.0.1", "saferphore": "0.0.1",
"socket.io": "^2.1.1",
"sortify": "^1.0.4", "sortify": "^1.0.4",
"stream-to-pull-stream": "^1.7.2", "stream-to-pull-stream": "^1.7.2",
"tweetnacl": "~0.12.2", "tweetnacl": "~0.12.2",

@ -5,7 +5,7 @@ var Express = require('express');
var Http = require('http'); var Http = require('http');
var Https = require('https'); var Https = require('https');
var Fs = require('fs'); var Fs = require('fs');
var WebSocketServer = require('ws').Server; var SocketIO = require('socket.io');
var NetfluxSrv = require('./node_modules/chainpad-server/NetfluxWebsocketSrv'); var NetfluxSrv = require('./node_modules/chainpad-server/NetfluxWebsocketSrv');
var Package = require('./package.json'); var Package = require('./package.json');
var Path = require("path"); var Path = require("path");
@ -246,7 +246,10 @@ var nt = nThen(function (w) {
console.log("setting up a new websocket server"); console.log("setting up a new websocket server");
wsConfig = { port: websocketPort}; wsConfig = { port: websocketPort};
} }
var wsSrv = new WebSocketServer(wsConfig); var wsSrv = new SocketIO(httpServer, {
path: config.websocketPath || '/cryptpad_websocket'
});
Storage.create(config, function (store) { Storage.create(config, function (store) {
NetfluxSrv.run(store, wsSrv, config, rpc); NetfluxSrv.run(store, wsSrv, config, rpc);
}); });

Loading…
Cancel
Save