* registering SocketIO instance * @param connection * @param options
(connection, options)
| 43 | * @param options |
| 44 | */ |
| 45 | connect(connection, options){ |
| 46 | |
| 47 | if(connection && typeof connection === 'object'){ |
| 48 | |
| 49 | Logger.info('Received socket.io-client instance'); |
| 50 | |
| 51 | return connection; |
| 52 | |
| 53 | } else if(typeof connection === 'string'){ |
| 54 | |
| 55 | Logger.info('Received connection string'); |
| 56 | |
| 57 | return this.io = SocketIO(connection, options); |
| 58 | |
| 59 | } else { |
| 60 | |
| 61 | throw new Error('Unsupported connection type'); |
| 62 | |
| 63 | } |
| 64 | |
| 65 | } |
| 66 | |
| 67 | } |