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
45
votes
2 answers

Socket.io: How many concurrent connections can WebSockets handle?

I am wondering if you have any data on concurrent connections to websockets? I am using Socket.io on Node.js server. How many clients can connect to socket and receive data without bringing my server down? 1000? 1000.0000? Thanks!
Pono
  • 11,298
  • 9
  • 53
  • 70
45
votes
2 answers

Live Video Stream on a Node.js Server

I have been researching this a lot but am frustrated as I feel like the solution should be simple though I know wont be. Ideally i'd just want to use node to host the server, webrtc getusermedia to get the live stream on the local client and use…
joshy.poo
  • 573
  • 1
  • 5
  • 10
45
votes
3 answers

GET http://localhost:3000/socket.io/socket.io.js 404 (Not Found)

I'm trying to stream data to the browser. I'm struggling, however, to connect it to the browser. Here's my html:
    babbaggeii
    • 7,577
    • 20
    • 64
    • 118
    45
    votes
    4 answers

    npm install for some packages (sqlite3, socket.io) fail with error MSB8020 on Windows 7

    When trying to install some node.js packages (sqlite3 and socket.io in particular) using npm install socket.io on my Windows 7 machine with Visual Studio 2012 (and not 2010) I had some failures that looked like this: C:\Program Files …
    Gloopy
    • 37,767
    • 15
    • 103
    • 71
    45
    votes
    6 answers

    socket.io.js not found

    For some reason my node server cannot serve the route /socket.io/socket.io.js, I always get a 404 error. I tried compiling different node versions (current is 0.6.13 which also runs on server, where it actually works). From the app.js I get info:…
    dan-lee
    • 14,365
    • 5
    • 52
    • 77
    43
    votes
    11 answers

    Socket.io custom client ID

    I'm making a chat app with socket.io, and I'd like to use my custom client id, instead of the default ones (8411473621394412707, 1120516437992682114). Is there any ways of sending the custom identifier when connecting or just using something to…
    pmerino
    • 5,900
    • 11
    • 57
    • 76
    43
    votes
    8 answers

    What is the disadvantage of using websocket/socket.io where ajax will do?

    Similar questions have been asked before and they all reached the conclusion that AJAX will not become obsolete. But in what ways is ajax better than websockets? With socket.io, it's easy to fall back to flash or long polling, so browser…
    oCpmture
    • 431
    • 1
    • 5
    • 4
    43
    votes
    2 answers

    socket.io: send message to specific room (client side)

    In socket.io, you usually use a specific syntax on the server side if you want to send a message to a specific room: io.to(room).emit('event', 'message');. But how would a client (what I mean is the socket.io-related code running in a browser)…
    alapeno
    • 2,724
    • 6
    • 36
    • 53
    43
    votes
    3 answers

    Connect to Socket.IO server with specific path and namespace

    My Node.js application is running at URL http://www.example.com/myapp/. I have configured a Socket.IO server (version 1.3.5) with a custom namespace. Here is an example code snippet: var server = http.createServer(...); var io =…
    guidoman
    • 1,071
    • 2
    • 11
    • 20
    43
    votes
    2 answers

    What is the difference between Socket.IO and Firebase?

    I watched a codeschool tutorial on Node.js and they imitated a chat server using Socket.IO in their tutorial. I am also under the impression that Firebase does the same thing. What is the difference between the two, if there are any?
    user3587754
    • 831
    • 2
    • 7
    • 20
    43
    votes
    6 answers

    socket.io - can't get it to work, having 404's on some kind of polling call

    I'm trying to get a server set up with socket.io, with bad results. I am mostly following this guide, although it's somewhat out of date: http://www.williammora.com/2013/03/nodejs-tutorial-building-chatroom-with.html The problem comes with…
    Eli
    • 4,874
    • 6
    • 41
    • 50
    43
    votes
    5 answers

    Socket.io how to send JavaScript object

    How to send JavaScript Object with Socket.io from server to client? I'm using Socket.io as WebSocket(sending with .send() and listen with message event). When I'm trying to do something like on server-side: var myObject = { message: 'Hello…
    zsd
    • 433
    • 1
    • 4
    • 4
    42
    votes
    8 answers

    getting how many people are in a chat room in socket.io

    I have this code right now that sets the nick and room: io.sockets.on('connection', function(client){ var Room = ""; client.on("setNickAndRoom", function(nick, fn){ client.join(nick.room); Room = nick.room; …
    re1man
    • 2,337
    • 11
    • 38
    • 54
    42
    votes
    17 answers

    how to list rooms on socket.io nodejs server

    after progress on the question how to create socket.io multicast groups, I found making rooms a great way to do what I needed. However, it would be great to know about all the rooms, without an extra data-structure. Is it possible to get a list of…
    pyramation
    • 1,631
    • 4
    • 22
    • 35
    42
    votes
    4 answers

    Authenticate user for socket.io/nodejs

    I have a php login, the user puts in a username/password, it checks the mysql db against the login information. If authenticated a session is created via php and the user can now access the system with the php session. My question is once they…
    John
    • 9,840
    • 26
    • 91
    • 137