fix: server start ans socket connection

This commit is contained in:
joshuashoemaker 2021-01-22 22:06:14 -06:00
parent 808904dfd6
commit 3c209d84f2
4 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
import { EventEmitter } from 'events'
import IEventManager from './Interfaces/IEventManager'
import IEventManager from '../Interfaces/IEventManager'
let instance: EventManager | null = null

View File

@ -3,8 +3,8 @@ import path from 'path'
import bodyParser from 'body-parser'
import http from 'http'
import { Socket } from 'socket.io'
import IEventManager from './Interfaces/IEventManager'
import EventManager from './EventManager'
import IEventManager from '../Interfaces/IEventManager'
import EventManager from '../Entities/EventManager'
class Server {
public app = express()
@ -50,12 +50,12 @@ class Server {
}
openSockets = (socketService: any) => {
socketService.on('connection', () => {
socketService.on('connection', (socket: Socket) => {
console.log('client connected')
})
socketService.on('message', (message: any) => {
console.log(message)
socket.on('offsets', (offsets: any[]) => {
this.onReceiveOffsets(offsets)
})
})
}

View File

@ -1,4 +1,4 @@
import EventManager from "../../EventManager"
import EventManager from "../../Entities/EventManager"
function makeEventManager () {
return new EventManager()

View File

@ -1,4 +1,4 @@
import { Server } from "socket.io";
import Server from "../../Entities/Server"
function makeServer (port: number) {
const defaultPort = 5005