@arcblock/ws 1.16.16 → 1.16.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,10 @@ const eventHub = cluster.isMaster ? require('@arcblock/event-hub/single') : requ
7
7
 
8
8
  const createLogger = require('../logger');
9
9
 
10
- const sleep = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout));
10
+ const sleep = (timeout) =>
11
+ new Promise((resolve) => {
12
+ setTimeout(resolve, timeout);
13
+ });
11
14
 
12
15
  const reply = (socket, topic, event, response, status = 'ok') => {
13
16
  if (socket.readyState === WebSocket.OPEN) {
@@ -74,6 +77,7 @@ class WsServer extends EventEmitter {
74
77
  const { pathname } = new URL(request.url, `http://${request.headers.host || 'unknown'}`);
75
78
  this.logger.debug('connect attempt', { pathname });
76
79
  if (this.pathname && pathname !== this.pathname) {
80
+ socket.write('HTTP/1.1 404 Pathname mismatch\r\n\r\n');
77
81
  socket.destroy();
78
82
  return;
79
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ws",
3
- "version": "1.16.16",
3
+ "version": "1.16.17",
4
4
  "description": "OCAP Chain websocket server and client",
5
5
  "keywords": [
6
6
  "websocket"
@@ -34,7 +34,7 @@
34
34
  "url": "https://github.com/ArcBlock/asset-chain/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@arcblock/event-hub": "1.16.16",
37
+ "@arcblock/event-hub": "1.16.17",
38
38
  "debug": "^4.3.3",
39
39
  "eventemitter3": "^4.0.4",
40
40
  "nanoid": "3.x",
@@ -44,5 +44,5 @@
44
44
  "devDependencies": {
45
45
  "get-port": "^5.1.1"
46
46
  },
47
- "gitHead": "051f9620995cf24407374cc4811b0fa6ed6dc7ca"
47
+ "gitHead": "489ce5e03bce27ddcd535390228b11ab56e7a2e3"
48
48
  }