瀏覽代碼

Better typing of message handler

master
Kevin C. Coram 1 年之前
父節點
當前提交
2ef8c15f63
簽署人: kevin GPG 金鑰 ID: 0E64ECB9EDE572A3
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. +3
    -3
      apps/api/src/app/app.gateway.ts

+ 3
- 3
apps/api/src/app/app.gateway.ts 查看文件

@@ -10,8 +10,8 @@ import {
WebSocketGateway,
WebSocketServer,
} from '@nestjs/websockets';
import { Server } from 'http';
import { AppService } from './app.service';
import { Server,Socket } from 'socket.io';

@WebSocketGateway(4001)
export class AppGateway implements OnGatewayConnection {
@@ -22,12 +22,12 @@ export class AppGateway implements OnGatewayConnection {

constructor(private appService: AppService) {}

handleConnection(client: any, ...args: any[]) {
handleConnection(client: Socket, ...args: any[]) {
client.emit(MESSAGE_TO_CLIENT, this.appService.getMessages());
}

@SubscribeMessage(MESSAGE_TO_SERVER)
handleMessage(client: any, payload: Message): void {
handleMessage(client: Socket, payload: Message): void {
this.logger.log(payload);
this.appService.addMessage(payload);
this.wss.emit(MESSAGE_TO_CLIENT, this.appService.getMessages());


Loading…
取消
儲存