Reputation: 5125
Whats the difference between socket.io and socket.io-client?
Some project I'm trying to use is using socket.io-client, but I'm used to using plain old socket.io, and it dons't really lay it out in the documentation.
Upvotes: 2
Views: 292
Reputation: 7181
The main difference I'm aware of is that with the socket.io-client library you can connect your server to another server serving socket.io events.
For example, if my server at http://localhost
is emitting a data
event, I can listen on another server like so:
var socket = require('socket.io')('http://localhost');
socket.on('connect', function(){
socket.on('data', function(data){
// Do something with data
});
});
and respond accordingly with the data object passed.
Upvotes: 3