浏览代码

cookie: false

master
peter 4 年前
父节点
当前提交
2b722822cf
共有 2 个文件被更改,包括 4 次插入6 次删除
  1. 1
    1
      package.json
  2. 3
    5
      src/PromiseIO/Server.ts

+ 1
- 1
package.json 查看文件

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "rpclibrary",
3
-  "version": "2.2.0",
3
+  "version": "2.2.1",
4 4
   "description": "rpclibrary is a websocket RPC library",
5 5
   "main": "./js/Index.js",
6 6
   "repository": {

+ 3
- 5
src/PromiseIO/Server.ts 查看文件

@@ -2,7 +2,7 @@ import { Server, Socket } from "socket.io"
2 2
 import { Server as httpServer } from "http"
3 3
 import * as U from '../Utils'
4 4
 import * as T from '../Types'
5
-const socketio = require('socket.io')
5
+import socketio = require('socket.io')
6 6
 
7 7
 export class PromiseIO {
8 8
     io?: Server
@@ -18,7 +18,7 @@ export class PromiseIO {
18 18
 
19 19
     attach(httpServer: httpServer) {
20 20
         this.httpServer = httpServer
21
-        this.io = socketio(httpServer)
21
+        this.io = socketio(httpServer, { cookie:false })
22 22
         this.io!.on('connection', (sock: Socket) => {
23 23
             const pioSock = U.makePioSocket(sock)
24 24
             this.listeners['socket'].forEach(listener => listener(pioSock))
@@ -38,9 +38,7 @@ export class PromiseIO {
38 38
     }
39 39
 
40 40
     listen(port: number) {
41
-        this.io!.listen(port, {
42
-            cookie: false
43
-        })
41
+        this.httpServer!.listen(port)
44 42
     }
45 43
 
46 44
     on(eventName: string, listener: T.AnyFunction) {

正在加载...
取消
保存