简体   繁体   English

使用 Nestjs 在 Socket.io 上监听事件时出现问题

[英]Issues at listenings events on Socket.io with Nestjs

I have some problems when trying to listen to specific events on socket.io.在尝试收听 socket.io 上的特定事件时,我遇到了一些问题。 I initiate ws server on the nest like their tutorial, also the connection is ok but when I try to connect in frontend the socket object returns properties like: `{..., "connected": false, "disconnected": true}我像他们的教程一样在嵌套上启动 ws 服务器,连接也正常,但是当我尝试在前端连接时,套接字 object 返回如下属性:`{...,“已连接”:false,“已断开”:true}

enter image description here在此处输入图像描述

nest code image嵌套代码图像

enter image description here在此处输入图像描述

when I am calling emit on server-side当我在服务器端调用发射时

enter image description here在此处输入图像描述

and the response from the server receives an updated JSON, but I can't hear the progress event,并且来自服务器的响应收到更新的 JSON,但我听不到progress事件,

enter image description here在此处输入图像描述

Looks like you're using Socket.IO v3 which isn't yet supported by NestJS yet.看起来您正在使用 NestJS尚不支持的Socket.IO v3。 Downgrade to version 2.降级到版本 2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM