|
@@ -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) {
|