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 { EventEmitter } from 'events'
import IEventManager from './Interfaces/IEventManager' import IEventManager from '../Interfaces/IEventManager'
let instance: EventManager | null = null let instance: EventManager | null = null

View File

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

View File

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

View File

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