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
76
votes
3 answers

The app references non-public selectors in Payload/.app/: decoder

I am getting this warning while submitting app to the Apps store through organizer. The app references non-public selectors in Payload/.app/: decoder i know we get this warning if we use any Third Party API in our application. I have used…
Akshay Aher
  • 2,525
  • 2
  • 18
  • 33
75
votes
1 answer

Pusher vs Pubnub vs open source Socket.io / SignalR.net / Faye / jWebSocket

I'm evaluating Pusher and PubNub at the moment to enable bi-directional realtime communications between my primarily web clients and my servers. Both look impressive, with Pusher's docs seeming to be better, and PubNub's scalability and reliability…
Matthew O'Riordan
  • 7,981
  • 4
  • 45
  • 59
74
votes
2 answers

how does socket.io work?

I am using socket.io and it was quick to setup (thanks to examples on their usage page) but i'd like to find out more about what exactly is going on under covers and what's the technology that makes it work. what are the exact mechanics of…
Sonic Soul
  • 23,855
  • 37
  • 130
  • 196
73
votes
1 answer

Creating Rooms in Socket.io

I would like to ask for your help. I'm having a hard time in my client side of socket.io, I would like to call this code in my client side to create a room in socket.io: var rooms = []; socket.on('create', function (roomname) { rooms[room] =…
Joenel de Asis
  • 1,401
  • 3
  • 15
  • 14
72
votes
4 answers

Scaling Socket.IO to multiple Node.js processes using cluster

Tearing my hair out with this one... has anyone managed to scale Socket.IO to multiple "worker" processes spawned by Node.js's cluster module? Lets say I have the following on four worker processes (pseudo): // on the server var express =…
Lee Benson
  • 11,185
  • 6
  • 43
  • 57
72
votes
3 answers

Node.js EMFILE error with increasing traffic

I have very recently received a lot of traffic to my site that runs Node.js. With the increasing traffic it has started to crash a lot, which has not happened before. I get the following error in my log: { [Error: connect EMFILE] code: 'EMFILE',…
codekick
  • 723
  • 1
  • 5
  • 4
71
votes
11 answers

How to unsubscribe from a socket.io subscription?

Suppose there are objects making subscriptions to a socket server like so: socket.on('news', obj.socketEvent) These objects have a short life span and are frequently created, generating many subscriptions. This seems like a memory leak and an error…
Bijou Trouvaille
  • 8,794
  • 4
  • 39
  • 42
71
votes
6 answers

Unit testing Node.js and WebSockets (Socket.io)

Could anyone provide a rock-solid, dead-simple unit test for Node.js using WebSockets (Socket.io)? I'm using socket.io for Node.js, and have looked at socket.io-client for establishing the client connection to a server in the test. However, I seem…
mysterlune
  • 1,691
  • 1
  • 12
  • 12
68
votes
3 answers

How to connect two node.js servers with websockets?

Here's my problem: I have server A, running node.js and using socket.io for communicating with clients (web browsers). This all is running fine and dandy. However, now that I have server B, which also needs to connect to server A through websockets,…
crappish
  • 2,688
  • 3
  • 28
  • 42
68
votes
1 answer

Node.js, Socket.io, Redis pub/sub high volume, low latency difficulties

When conjoining socket.io/node.js and redis pub/sub in an attempt to create a real-time web broadcast system driven by server events that can handle multiple transports, there seems to be three approaches: 'createClient' a redis connection and…
lebear
  • 689
  • 1
  • 6
  • 3
65
votes
9 answers

nodejs: listen EACCES: permission denied 0.0.0.0:80

I am trying to create https server to test socket io by node js. According this page openssl genrsa -out privatekey.pem 2048 openssl req -new -key privatekey.pem -out certrequest.csr openssl x509 -req -in certrequest.csr -signkey privatekey.pem…
Cyrus the Great
  • 5,145
  • 5
  • 68
  • 149
64
votes
4 answers

What's the difference between engine.io and socket.io?

Regarding node.js, I'm using socket.io for real-time socket connection from the client application to the server application. I just heard about engine.io. Is engine.io a replacement for socket.io? I could not find any useful information on…
L N
  • 2,856
  • 4
  • 20
  • 30
64
votes
1 answer

Push Notifications or Socket.io?, or Both?

I'm developing a chat system for web, Android and iOS. Doing my research I've found differences on how GCM and APNS handle the Push Notifications. If I send a Push Notification to a Android Device through the GCM, the device its able to decide if it…
63
votes
8 answers

socket.io-client how to set request header when making connection

I'm trying to set a http header when socket.io client makes the connection request. Is there a way to do this? Here is what i'm doing: // server side var io = socketio(server); io.use(function (socket, next) { // authorize using authorization…
Ziyu
  • 1,047
  • 2
  • 10
  • 9
63
votes
6 answers

"websocket was interrupted while page is loading" on Firefox for Socket.io

Error: The connection to was interrupted while the page was loading. Source File: localhost/socket.io/node_modules/socket.io-client/dist/socket.io.js Line: 2371 I am new to socket.io and I have tried to search for this, but I didn't get…
Amar
  • 681
  • 1
  • 5
  • 7