use latest ws
This commit is contained in:
parent
1a84c1db10
commit
4f53821a2c
14
client.js
14
client.js
|
@ -42,17 +42,19 @@ function getConnection(opts, verbs, mySocket, retry) {
|
|||
// TODO how to include path and such?
|
||||
// http://unix:/absolute/path/to/unix.socket:/request/path
|
||||
// https://github.com/websockets/ws/issues/236
|
||||
var address = require('url').parse('ws+unix:' + opts.sock);
|
||||
var ws;
|
||||
address.pathname = opts.sock;
|
||||
address.path = '/' + (require('cluster').worker||{}).id + '/' + opts.ipcKey;
|
||||
address.query = {
|
||||
var pathname = '/' + (require('cluster').worker||{}).id + '/' + opts.ipcKey;
|
||||
var queryparams = {
|
||||
ipcKey: opts.ipcKey
|
||||
, ipc_key: opts.ipcKey
|
||||
, worker_id: (require('cluster').worker||{}).id
|
||||
};
|
||||
address.path += '?' + require('querystring').stringify(address.query);
|
||||
ws = new WebSocket(address);
|
||||
var search = require('querystring').stringify(queryparams);
|
||||
var wspath = 'ws+unix://' + opts.sock + ':' + pathname + '?' + search;
|
||||
// https://github.com/websockets/ws/blob/master/doc/ws.md#unix-domain-sockets
|
||||
// ws+unix:///absolule/path/to/uds_socket:/pathname?search_params
|
||||
console.log('ws connect', wspath);
|
||||
ws = new WebSocket(wspath);
|
||||
|
||||
ws.on('error', function (err) {
|
||||
console.error('[ERROR] ws connection failed, retrying');
|
||||
|
|
|
@ -26,6 +26,6 @@
|
|||
"homepage": "https://github.com/coolaj86/sqlite3-cluster#readme",
|
||||
"dependencies": {
|
||||
"sqlite3": "^3.0.9",
|
||||
"ws": "^0.7.2"
|
||||
"ws": "^2.3.1"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue