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
53
votes
4 answers

WebRTC and Websockets. Is there a difference

I'm assuming that WebRTC is an API that decodes/encodes audio and video, although the communication between the server and the clients is done via web sockets, or some other network protocol? I'm a bit confused. Does WebRTC have its own…
AndrewMcLagan
  • 13,459
  • 23
  • 91
  • 158
52
votes
8 answers

how to get session id of socket.io client in Client

I want to get session id of client in my socket.io client. here is my socket.io client : var socket = new io.Socket(config.host, {port: config.port, rememberTransport: false}); // when connected, clear out display …
XMen
  • 29,384
  • 41
  • 99
  • 151
52
votes
6 answers

Socket.io with nginx

I'm trying to serve static files by nginx 1.6 and to proxy socket traffic coming from Node.js web server with socket.io . This is the relevant part of nginx.conf: location /socket.io/ { proxy_pass http://localhost:3000; …
Aleks
  • 5,674
  • 1
  • 28
  • 54
52
votes
1 answer

Socket.IO subscribe to multiple channels

I want to build a simple chat room system on top of Socket.IO where user can create a new chat room and then people can start chatting. This sound simple but as the Socket.IO 0.9.4 I'm running now, after reading a few SO posts together with the…
Phương Nguyễn
  • 8,747
  • 15
  • 62
  • 96
52
votes
13 answers

Improve this AngularJS factory to use with socket.io

I want to use socket.io in AngularJS. I found the following factory: app.factory('socket', function ($rootScope) { var socket = io.connect(); return { on: function (eventName, callback) { socket.on(eventName, function ()…
Gal Ben-Haim
  • 17,433
  • 22
  • 78
  • 131
51
votes
3 answers

Best java server implementation for socket.io

I wanted to use socket.io to push data from server to browser but the project is java tomcat one, and there are many implementation in Github for the server implementation of socket.io. Most of them say they are deprecated or better ones are…
Jiby Jose
  • 3,745
  • 4
  • 24
  • 32
50
votes
3 answers

Connecting client to server using Socket.io

I'm relatively new to node.js and it's addons, so this is probably a beginnersquestion. I'm trying to get a simple HTML page on a webserver connect to a different server running node.js with websocket.io. My code looks like this: Client
shmow
  • 622
  • 1
  • 8
  • 19
49
votes
2 answers

Can't find socket.io.js

Possible Duplicate: socket.io.js not found I am using the most up to date version of Socket.IO and I'm trying the first example on the how to use page, however, I'm getting an error when I try to get to '/socket.io/socket.io.js' The javascript…
Esaevian
  • 1,707
  • 5
  • 18
  • 30
49
votes
6 answers

Socket.IO Client Library in Python

Can anyone recommend a Socket.IO client library for Python? I've had a look around, but the only ones I can find are either server implementations, or depend on a framework such as Twisted. I need a client library that has no dependencies on other…
Ada
  • 1,746
  • 4
  • 15
  • 15
49
votes
3 answers

Socket IO Server to Server

Is it possible for a server to connect to another using Socket.IO and be treated like a client? And have it join rooms, recieve io.sockets.in('lobby').emit(). And more? The first server is also listening for connections/messages as well. Hey Brad,…
Taurian
  • 1,660
  • 7
  • 20
  • 28
49
votes
5 answers

Socket IO reconnect?

How to reconnect to socket io once disconnect has been called? Here's the code function initSocket(__bool){ if(__bool == true){ socket = io.connect('http://xxx.xxx.xxx.xxx:8081', {secure:false}); …
Eric
  • 9,870
  • 14
  • 66
  • 102
48
votes
5 answers

Socket.io connection url?

I have the current setup: Nodejs Proxy (running http-reverse-proxy) running on port 80. Rails server running on port 3000 Nodejs web server running on port 8888 So any request starting with /nodejs/ will be redirected to nodejs web server on…
xjq233p_1
  • 7,810
  • 11
  • 61
  • 107
48
votes
3 answers

How to use Socket.io with Next.js API Routes

Next.js provides serverless API routes. By creating a file under ./pages/api you can have your service running, and I want to have a Socket.io service by using this mechanism. I have created a client: ./pages/client.js import { useEffect } from…
Aurelius
  • 689
  • 1
  • 6
  • 16
46
votes
2 answers

Memory leak when emitting messages with Socket.IO + Node.js + ZMQ

I have three applications talking to each other. A websocket server (1) that accepts connections from browsers, parses url to see what data is required, serves it to client if it has the data in memory, if not asks for it from another application…
Deniz Ozger
  • 2,565
  • 23
  • 27
45
votes
2 answers

How can Socket.io and RESTFul work together?

(I'm not familiar to RESTFul, please correct me if my concept is wrong) In RESTFul architecture, we map every action to an URL. If I click "post a article", may it's actually URL http://example.com/ and some data action=post&content=blahblah. If I…
Lai Yu-Hsuan
  • 27,509
  • 28
  • 97
  • 164