import type { Socket } from 'socket.io-client' import io from 'socket.io-client' import { GameLogger } from './GameLogger' import { GameConfig } from './config' export class SocketConnection { private static _connection: Socket private static readonly _logger = new GameLogger('📶 SocketConnection') public static createConnection(): void { if (this._connection == null) this._connection = io(GameConfig.getValue('url.socket')) else return this._logger.error('Cannot establish connection, a connection is already up and going!') this._connection.on('message', (message) => { console.log(message) }) } }