Questions tagged [socket.io]

Socket.IO aims to make real-time apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. It supports multiple transports, such as WebSockets, Flash sockets, long polling, and more, automatically falling back when a transport fails.

Socket.IO is a Node.js package designed to make real-time applications possible and easy in every browser and mobile device. It supports the following transport mechanisms:

  • WebSockets
  • Adobe® Flash® Socket
  • AJAX long polling
  • AJAX multipart streaming
  • Forever Iframe
  • JSONP Polling

Socket.IO includes a JavaScript library that allows for easy programmatic communication with the server.

Some interesting Socket.IO features include:

  • Automatic JSON serialization
  • Namespacing connections over a single multiplexed connection
  • Volatile messages
  • Rooms (logically grouped connections)

API documentation can be found on the project's Wiki.

Useful Links:

20688 questions
39
votes
2 answers

Proxying WebSockets with TCP load balancer without sticky sessions

I want to proxy WebSocket connections to multiple node.js servers using Amazon Elastic Load Balancer. Since Amazon ELB does not provide actual WebSocket support, I would need to use its vanilla TCP messaging. However, I'm trying to understand how…
Justin Meltzer
  • 13,318
  • 32
  • 117
  • 182
39
votes
2 answers

What should I be using? Socket.io rooms or Redis pub-sub?

Pretty simple question. I am building a realtime game using nodejs as my backend and I am wondering if there is any information available on which one is more reliable and which one is more efficient? I am heavily using both Redis and Socket.io…
Josh Mc
  • 9,911
  • 8
  • 53
  • 66
39
votes
2 answers

HTTPS error "data length too long" in s3_pkt.c from Socket.io

We’re trying to get Socket.io flashsockets to work in Internet Explorer 9 over HTTPS/WSS. The flashsockets work over HTTP, but HTTPS is giving us problems. We’re using socket.io version 0.8.7 and socket.io-client version 0.9.1-1. We’re running our…
user730569
  • 3,940
  • 9
  • 42
  • 68
39
votes
3 answers

socket.io: disconnect event isn't fired

I have made a simple realtime visitor counter. You can download it from this repository. What happens is that disconnect event (even after browser closing) on server is never fired. server.js is: (function () { var app, count, express,…
Giovanni Bitliner
  • 2,032
  • 5
  • 31
  • 50
37
votes
2 answers

socket.io client not receiving messages from server

I'm trying to implement a system with two clients one of them sends a message and the other one shall receive it. The figure below will explain it in a more visual way: So, the client 1 send the message to the server (and this works), the server…
holographix
  • 2,497
  • 2
  • 32
  • 46
37
votes
4 answers

Node.js - How can I remove the port from the url?

I use the node.js and socket.io. My application runs on the port 3000. The application starts from from the url: mydomain.com:3000/ I want to run the application from mydomain.com - I want to remove the port from the url. Where and how can I set…
Jenan
  • 3,408
  • 13
  • 62
  • 105
37
votes
5 answers

Schedule Node.js job every five minutes

I'm new to node.js. I need node.js to query a mongodb every five mins, get specific data, then using socket.io, allow subscribed web clients to access this data. I already have the socket.io part set up and of course mongo, I just need to know how…
KingFish
  • 8,773
  • 12
  • 53
  • 81
37
votes
8 answers

How can i export socket.io into other modules in nodejs?

I have socket.io working in app.js but when i am trying to call it from other modules its not creating io.connection not sure ? app.js var express = require('express'); var app = express(); var server = require('http').createServer(app); var io =…
hussain
  • 6,587
  • 18
  • 79
  • 152
37
votes
6 answers

How do I get the http.server from the express app?

I am writing a server-side node.js application that uses express to handle HTTP requests and I'm adding websockets (socket.io) support. However I don't have access to the code that starts the HTTP server. I am writing an express router and functions…
Graeme Perrow
  • 56,086
  • 21
  • 82
  • 121
37
votes
18 answers

Socket IO Rooms: Get list of clients in specific room

I'm trying to display a list of clients in a specific room. I just want to show their username, and not their socket id. This where I'm at: socket.set('nickname', "Earl"); socket.join('chatroom1'); console.log('User joined chat room 1); var…
Taurian
  • 1,660
  • 7
  • 20
  • 28
36
votes
9 answers

Sending message to specific client with socket.io and empty message queue

I´m going crazy with socket.io! Documentation is so bad it's simply not true. I want to send a feedback to specific client over socket.io My server side looks like this: app.get('/upload', requiresLogin, function(request, response) { …
krevativ
  • 530
  • 1
  • 8
  • 9
36
votes
3 answers

React-Redux and Websockets with socket.io

I'm new with that technology React-Redux and I would like your help with some implementation. I want to implement one chat application with sockets (socket.io). First, the user has to sign up (I use passport in the server side) and after, if the…
DustInTheSilence
  • 575
  • 1
  • 7
  • 15
36
votes
3 answers

socket.io determine if a user is online or offline

We can trace if a connection is established or disconnected by this code console.log('a user connected'); socket.on('disconnect', function () { console.log('user disconnected'); }); Well, its fine. But how can we determine what user…
Shahid Karimi
  • 4,096
  • 17
  • 62
  • 104
36
votes
4 answers

Where is the Socket.IO client-side .js file located?

I am trying to get socket.io (Node library) to work. I have the server-side js working, and it is listening. The socket.io website states simply: