fix: server start ans socket connection
This commit is contained in:
parent
808904dfd6
commit
3c209d84f2
@ -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
|
||||||
|
|
@ -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)
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import EventManager from "../../EventManager"
|
import EventManager from "../../Entities/EventManager"
|
||||||
|
|
||||||
function makeEventManager () {
|
function makeEventManager () {
|
||||||
return new EventManager()
|
return new EventManager()
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user