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
5
votes
1 answer

Socket.io-based app running through node proxy server disconnecting all sockets whenever one disconnects

I made a basic chat app using node.js, express and socket.io. It's not too different from the tutorial chat app for socket.io, it simply emits events between connected clients. When I ran it on port 3001 on my server, it worked fine. Then I made a…
Danneh
  • 201
  • 4
  • 10
5
votes
1 answer

How to detect when socket.io transport changes? (event or something)

I'm trying to connect to server io.js+socket.io with socket.io client. It starts with xhr polling requests, the connect event and even first message are receiving throught xhr, then it upgrades to websocket. How can i detect when the switch of the…
ForceUser
  • 1,129
  • 1
  • 15
  • 23
5
votes
1 answer

Socket.IO: Reconnect Causes Server Connect Code to Run Twice

Whenever I disconnect using socket.disconnect(); and then reconnect using socket.connect();, the server runs my handshake code twice. The strange thing is, even though the server connection code runs twice, there is only one connection in my array…
Nifty255
  • 397
  • 2
  • 3
  • 14
5
votes
1 answer

Sails 0.11 catching socket events from server side

As per the new release of sails v0.11, the function onConnect is deprecated in config/sockets.js file. I couldn't implement the socket.on events or catch socket events from server side. Is there any way to implement ? working by updating code in…
5
votes
1 answer

emitting from thread using flask's socketio extension

I want to emit a delayed message to a socket client. For example, when a new client connects, "checking is started" message should be emitted to the client, and after a certain seconds another message from a thread should be emitted.…
Muatik
  • 4,011
  • 10
  • 39
  • 72
5
votes
1 answer

Socket.io constantly polling... should it be doing this?

I have a node server and a web page connected via socket.io. I noticed in the browser console that it is outputting XHR finished loading: GET "http://my_url/socket.io/?EIO=3&transport=polling&t=1418944327412-412&sid=vqLTUtW3QhNLwQG8AAAA". and…
ed209
  • 828
  • 2
  • 14
  • 30
5
votes
1 answer

Socket.io automatic timeout and transport error

I am building a chat application using node-Js(0.10.33), socket.io server and client(both 1.2.1) and express(3.18.4). I am using reverse proxy to hide the url(example.com:8083). I have been facing an issue with automatic timeout and causing…
GRISHMA SINHA
  • 51
  • 1
  • 2
5
votes
2 answers

Socket.io examples with Swift and Node.js on the backend

I am trying to find a working example of a Socket.io implementation on iOS with Swift, but have been unlucky so far. I did get a few examples from Github, but each have some issues and I cannot tell why they don’t work. Does anyone know where I can…
Eduárd Moldován
  • 1,495
  • 3
  • 13
  • 29
5
votes
2 answers

socket.io error undefined is not a function

Installed websocket and socket.io on the server. When I load the browser page, I get this error in the console: Uncaught TypeError: undefined is not a function (socket.io-1.2.1.js:1) Here is the server side code: // Require HTTP module (to start…
K4elo
  • 73
  • 1
  • 5
5
votes
4 answers

How do you export a variable from app.js into another route in Node js

i'm using socket.io in my node project and wanted to know how to possibly export the io variable this is what i have done so far but i get this error: Object # has no method 'on' in app.js: var express = require('express'); var path…
ipalibowhyte
  • 1,553
  • 2
  • 22
  • 34
5
votes
2 answers

xhr poll error come out is throwing while use socket.io

I wrote a very simple demo about socket.io And I package it by using phonegap. I found there is problem. After I open my app about ten seconds ,the connection will disconnect because of xhr poll error.if I refresh the page in disconnect event the…
user3898462
  • 51
  • 1
  • 5
5
votes
2 answers

Get user id socket.io, passport, koa

I'm using Koa, Passport.js and koa-session to authenticate users. So it basically looks like: // session var session = require('koa-session'); app.keys = [config.secret]; app.use(session()); // auth require(__dirname+'/lib/auth'); //…
Cohars
  • 3,822
  • 1
  • 29
  • 50
5
votes
0 answers

How to get Advanced Rest Client to work with socket.io

I am trying to use Advanced Rest Client (a Chrome extension/app) with socket.io, but it does not connect to my NodeJS socket.io server. Is the problem perhaps that I cannot use ws://localhost and have to use another protocol first? I know that…
Onestone
  • 609
  • 2
  • 10
  • 23
5
votes
1 answer

Node.js socket.io with websocket

I'm begginer in Node.js or websocket. I have problem: My HTML code: test
5
votes
2 answers

WebSocket handshake in Node.JS, Socket.IO and Clusters not working

I having a problem with clustering my application with Node.js, socket.io and node.js clusters. I using the socket.io-redis to share the information for all workers, but is not working. My code: var cluster = require('cluster'); var numCPUs =…
GabrielBiga
  • 388
  • 5
  • 19
1 2 3
99
100