简体   繁体   English

连接到服务器后,NodeJ多次答复请求

[英]NodeJs multiple reply for requests after connecting to server

when my device is disconnected from server or device don't have internet connection, after emitting multiple socket to server that cause of reply to all sockets after connecting to server 当我的设备与服务器断开连接或设备没有Internet连接时,向服务器发出多个套接字后,导致在连接到服务器后回复所有套接字

for example: 例如:

1- client disconnected from server, i click multiple on button to emit data for example 10 click as request 1-客户端与服务器断开连接,我单击多个按钮以发出数据,例如按请求单击10次

2- after connecting client to server, server reply on 10 response 2-将客户端连接到服务器后,服务器对10个响应进行回复

how can i manage this process? 我如何管理这个过程?

problem resolved, Thanks to @farhadamjady 解决了问题,感谢@farhadamjady

var mySocket = io.connect('http://192.168.1.4:8080/backend_app', {transports: ['websocket'], reconnection: true});

mySocket.on('connect', function () {
    mySocket.sendBuffer=[]
    console.log('Connected!');
});

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

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