在客户端接收多条消息时,我可以依赖它的发送顺序吗?
例如,请考虑以下代码:
let io = require('socket.io')(80);
io.on('connection', (socket) => {
socket.emit('myevent', 'First event');
socket.emit('myevent', 'Second event');
})
let socket = new io()
.on('myevent', (msg) => {
console.log(msg);
})
我可以确定邮件会以正确的顺序记录,我的意思是:
First event
Second event