我已经在 Loopback 4 中创建了我的 rest 应用程序,现在我想在其中实现套接字。有什么办法可以在 RestApplication 中这样做吗?
export class MyApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
) {
constructor(
options: ApplicationConfig = {}
) {
super(options);
}
....
async start() {
await super.start();
const io = socketio(this.restServer);
io.on('connection', (socket: any) => {
console.log('connected');
});
}
}
const io = socketio(this.restServer);
不适合我