Websocket を使用するために「イベント」モジュールをアプリケーションに追加しようとしていますが、モジュールを追加すると次のエラーが発生します。
(node:59905) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Request mapping properties not defined in the @RequestMapping() annotation!
(node:59905) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
他のすべてのモジュールは正常にロードおよびマップされ、EventsModule を追加した場合にのみ発生します
だからここに私が持っているコードがあります:
app.module.ts
@Module({
modules: [AuthModule, DatabaseModule, UsersModule, TimespansModule, LogsModule, EntitiesModule, EventsModule]
})
events.module.ts
import {EventsComponent} from './events.component';
import {Module} from '@nestjs/common';
@Module({
controllers: [EventsComponent]
})
export class EventsModule {}
events.component.ts
import {WebSocketGateway, SubscribeMessage, OnGatewayConnection} from '@nestjs/websockets';
@WebSocketGateway({namespace: 'events'})
export class EventsComponent implements OnGatewayConnection {
handleConnection(client: any) {
console.log('client connected');
}
@SubscribeMessage('stream-received')
onStream(client, data) {
console.log('stream received');
}
}
ここで何が問題なのか本当にわかりません。また、エラーメッセージもあまり役に立ちません。