forked from noxious/server
Replaced all event names with numbers for less bandwidth usage
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import fs from 'fs/promises'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
@@ -12,7 +13,7 @@ type Payload = {
|
||||
|
||||
export default class GMTileDeleteEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
this.socket.on('gm:tile:delete', this.handleEvent.bind(this))
|
||||
this.socket.on(SocketEvent.GM_TILE_DELETE, this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(data: Payload, callback: (response: boolean) => void): Promise<void> {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Tile } from '#entities/tile'
|
||||
import TileRepository from '#repositories/tileRepository'
|
||||
@@ -6,7 +7,7 @@ interface IPayload {}
|
||||
|
||||
export default class TileListEven extends BaseEvent {
|
||||
public listen(): void {
|
||||
this.socket.on('gm:tile:list', this.handleEvent.bind(this))
|
||||
this.socket.on(SocketEvent.GM_TILE_LIST, this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(data: IPayload, callback: (response: Tile[]) => void): Promise<void> {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
@@ -11,7 +12,7 @@ type Payload = {
|
||||
|
||||
export default class TileUpdateEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
this.socket.on('gm:tile:update', this.handleEvent.bind(this))
|
||||
this.socket.on(SocketEvent.GM_TILE_UPDATE, this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(data: Payload, callback: (success: boolean) => void): Promise<void> {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import fs from 'fs/promises'
|
||||
import { writeFile } from 'node:fs/promises'
|
||||
|
||||
@@ -11,7 +12,7 @@ interface ITileData {
|
||||
|
||||
export default class TileUploadEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
this.socket.on('gm:tile:upload', this.handleEvent.bind(this))
|
||||
this.socket.on(SocketEvent.GM_TILE_UPLOAD, this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(data: ITileData, callback: (response: boolean) => void): Promise<void> {
|
||||
|
Reference in New Issue
Block a user