简体   繁体   中英

socket.emit - Event name [socket.io]

I use:

Server:

socket.emit('news', 'ZZZ');

Client:

socket.on('news', function (data) {
    document.querySelector('#gamesList').innerHTML = data;
});

All is working!

But if i change event name to a "temp":

Server:

socket.emit('temp', 'ZZZ');

Client:

socket.on('temp', function (data) {
    document.querySelector('#gamesList').innerHTML = data;
});

It's not working! Why? I can't use my own event names?

Thank in advance!

Clear your browser's cache.

If you use the "Symfony 2 Framework", correctly use "assetic".

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