Add barebone to support socket.io
(This is more a temp commit to update the frontend)
This commit is contained in:
24
backend/lib/socketio.ts
Normal file
24
backend/lib/socketio.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as socketio from "socket.io";
|
||||
|
||||
/**
|
||||
* This class handles all SocketIO connections.
|
||||
*
|
||||
* *SocketIO is another layer ontop of WebSockets*
|
||||
*/
|
||||
class SocketManager {
|
||||
|
||||
io: socketio.Server;
|
||||
express: Express.Application;
|
||||
|
||||
constructor (express: Express.Application) {
|
||||
this.io = new socketio.Server(express);
|
||||
this.express = express;
|
||||
}
|
||||
|
||||
init() {
|
||||
this.io.on('connect', data => {
|
||||
console.log('New connection')
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user