Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit is lost #2485

Closed
ghost opened this issue Mar 11, 2016 · 2 comments
Closed

Emit is lost #2485

ghost opened this issue Mar 11, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 11, 2016

io.on('connection', function(socket) {
socket.emit('info', callback)
}

Client doesn't receive 'info'. I must ask the server for info from the client, first in order to receive anything, having server code like this:

io.on('connection', function(socket) {
socket.on('askforinfo', function(msg) {
socket.emit('info', {name: 'Peter Park' })
});

Obviously this is undesirable. The fact is that "emit" "on connection" is bugged.

@dsalcedo
Copy link

// client
var socket = io();
      socket.on('connection', function() {
         socket.emit('info', data);
     }); 
      socket.on('get_info', function(data) {
         console.log(data)
     }); 


// server code
io.on('connection', function(socket) {
   socket.on('info', function (data){
      socket.emit('get_info', data)
   });
});

@darrachequesne
Copy link
Member

That issue was closed automatically. Please check if your issue is fixed with the latest release, and reopen if needed (with a fiddle reproducing the issue if possible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants