Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Socket not responding to emit message #601

Closed
codecowboy opened this Issue · 1 comment

3 participants

@codecowboy

I see a connected message but no response to the message I am emitting?

var io = require('socket.io-client'),
    socket = io.connect('targeturl', {
        port: 8080
    });
socket.on('connect', function () {
    console.log("socket connected"); //this is printed.
    });
socket.emit('list', {"user":'username',"token": 'mytoken'});
socket.on('message', function(data){
    console.log(data);
});

socket.on('error', function(data){
    console.log(data); //nothing is printed
});

Can anyone explain why this doesn't work?

@j-salazar

The message event is only emitted when you use socket.send(). Furthermore, that event is emitted server-side, not client-side.

@rauchg rauchg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.