|
1 | 1 |
|
2 | 2 | // Require dependencies |
3 | | -import uuid from 'uuid'; |
4 | | -import config from 'config'; |
5 | | -import Daemon from 'daemon'; |
6 | | -import session from 'express-session'; |
7 | | -import socketio from 'socket.io'; |
8 | | -import SessionStore from '@edenjs/session-store'; |
9 | | -import cookieParser from 'cookie-parser'; |
| 3 | +import config from 'config'; |
| 4 | +import Daemon from 'daemon'; |
| 5 | +import session from 'express-session'; |
| 6 | +import socketio from 'socket.io'; |
| 7 | +import SessionStore from '@edenjs/session-store'; |
| 8 | +import cookieParser from 'cookie-parser'; |
| 9 | +import { v4 as uuid } from 'uuid'; |
10 | 10 |
|
11 | 11 | // require models |
12 | 12 | const User = model('user'); |
@@ -82,9 +82,6 @@ export default class SocketDaemon extends Daemon { |
82 | 82 | // Set io |
83 | 83 | this.__socketIO = socketio(this.eden.router.app.server); |
84 | 84 |
|
85 | | - // Listen for connection |
86 | | - this.__socketIO.on('connection', this.onConnect); |
87 | | - |
88 | 85 | // initialize store |
89 | 86 | SessionStore.initialize(session); |
90 | 87 |
|
@@ -124,6 +121,9 @@ export default class SocketDaemon extends Daemon { |
124 | 121 | next(); |
125 | 122 | }); |
126 | 123 |
|
| 124 | + // Listen for connection |
| 125 | + this.__socketIO.on('connection', this.onConnect); |
| 126 | + |
127 | 127 | // user |
128 | 128 | this.eden.on('socket.id', this.id, true); |
129 | 129 |
|
|
0 commit comments