简体   繁体   中英

socket.io client, doesn't emit message to server

var socket = io.connect('http://localhost:3001');


onClickEvent -> io.emit('test', 'testMessage');

I have this code. On click I'm emitting data to server. When I'm clicking to emit, from tab#1, it emitting properly. But When I'm clicking from tab #2, it doesn't emitting.

there is not any error, in console...

In both tabs, messages from server comes with no problem, but there is something wrong during emitting from client to server.

any idea?

应该使用:

socket.emit('test', 'testMessage');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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