Initial commit: NestJS NextJS pnpm monorepo
This commit is contained in:
commit
610dcf202b
175 files changed
+25172
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import {
|
||||
WebSocketGateway,
|
||||
SubscribeMessage,
|
||||
MessageBody,
|
||||
WebSocketServer,
|
||||
} from '@nestjs/websockets';
|
||||
import { Server } from 'socket.io';
|
||||
|
||||
@WebSocketGateway({
|
||||
cors: {
|
||||
origin: 'http://192.168.50.205',
|
||||
},
|
||||
})
|
||||
export class ChatGateway {
|
||||
@WebSocketServer()
|
||||
server: Server; // 👈 DAS fehlt dir gerade
|
||||
|
||||
@SubscribeMessage('message')
|
||||
handleMessage(@MessageBody() data: string) {
|
||||
console.log('msg:', data);
|
||||
this.server.emit('message', data);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user