FAQ Database Discussion Community


Where do sockets fit into the Flux unidirectional data flow?

javascript,websocket,socket.io,reactjs,flux
Where do sockets fit into the Flux unidirectional data flow? I have read 2 schools of thought for where remote data should enter the Flux unidirectional data flow. The way I have seen remote data for a Flux app fetched is when a server-side call is made, for example, in...

Openshift redis cartridge with strange exceptions ETIMEDOUT on socket.io script

node.js,redis,socket.io,openshift,openshift-cartridge
I have a socket.io node script running that acts as a chat server. I had it running on a local server ok, and have since tried moving it over to openshift. I used the following cartridge to get it working - https://github.com/smarterclayton/openshift-redis-cart/issues While running the local version of the server,...

SailsJS: Requiring Assets, Such As, sails.io.js

javascript,node.js,socket.io,gruntjs,sails.js
As the problem is short & sweet, I'll keep the question so. CAN'T LOAD ASSETS. Using Sails.js (v0.11.n). Can't load assets... That's about it... I'm trying to load sails.io.js -- or now even just assets/alert.js. <script type="text/javascript" src="/js/dependencies/sails.io.js"></script> Doesn't work :( Even when I switch the src to /alert.js --...

Which is the prefered way to add function to sockets in socket.io?

javascript,node.js,sockets,socket.io
Is there a "prototype" of all sockets connected to socket.io? I want to define some functions that will be available for each connected socket. Currently i have: io.sockets.on('connection', function(socket) { //Define properties and functions for socket socket.hello = function(){ console.log("hello from "+socket.id); } socket.hello(); }); But i'm defining a 'new'...

Socket.io redis How data stored and cleared

redis,socket.io,socket.io-redis
i am hosting an app on heroku which is using socket.io. it is using sockets and i am using heroku 4 standard 1X dynos . So for this i used redistogo service and socket.io-redis plugin. it's working great but i want to know does socket.io-redis also clear the data from...

Angular-fullstack generator production app does not properly serve socket.io?

javascript,angularjs,node.js,socket.io,angular-fullstack
I am running into trouble between two angular-fullstack apps deployed on AWS via same setup and configuration. It seems that socket.io-client/socket.io.js isn't served properly on one of them despite having same settings. Seems like it's getting an error 400 (bad request) when trying to get socket.io.js and in turn, it's...

cloudflare SSH and sockets: how to run them together?

sockets,socket.io,cloudflare
I am using a flexible SSL from cloudflare, so my site is now https://www.example.com Inside my site, I use socket.io : server = 'http://direct.example.com'; socket = io.connect(server+":1445" , {'force new connection': true }); Problem is I got: Mixed Content: The page at 'https://' was loaded over HTTPS, but requested an...

Socket between browser and iOS devices

ios,websocket,socket.io
We have a proprietary template format for rendering articles. We have written an editor in HTML for editing this. While editing/writing the template we want a live preview of the results directly on different iOS and android devices through a custom app we've made to preview. It seems redundant to...

socket io Websocket Disconnected Node js

javascript,node.js,express,websocket,socket.io
I am actually facing an issue here. I am having a login page From there I am going to another page. From there I am getting my socket disconnected. What i am trying to do is In my server side app.js app.post('/login', urlencodedParser, function(req, res) { req.session.username = req.body.usr; req.session.password...

Socket.io lost connection when phone locks

javascript,android,socket.io
setInterval(function(){ socket.emit("stayalive", { "room": room }); }, 5000); i got a simple browser application with an interval function running on my phone. Im debugging with Chrome on my Nexus 4. My problem is now: When i lock the phone, the interval stops after about 5 min and then my phone...

Emitting and receiving socket io within the same file

node.js,express,socket.io
I want to do something where I can set up a route to a link like /visit using app.get('/visit', function(req, res){}) etc. And inside that, I want to emit a message like socket.emit("event", "a message") and then inside my io.on("connection") function, be able to listen for event and return the...

Socket.IO - setInverval every two minutes (Node JS)

node.js,socket.io,setinterval
I have an event in socket.io which broadcasts how many users are online (based on who is logged in) to the user. What I think should be happening is that I ask the server to query the database once every two minutes using setInterval, and a rowset is returned, then...

socket io splitting functions into different files

javascript,node.js,sockets,socket.io
I am used to the way routing works in node.js however let me give you a typical example of a socket.io node server: /** * Created by root on 3/13/15. */ var multer = require('multer'); var express = require('express'); var app = express(); var http = require('http').Server(app); var io =...

setInterval doesn't get cleared, function keeps getting executed

javascript,node.js,socket.io,raspberry-pi
I have the following function: function monitorClimate() { var sensorReadingInterval; function startClimateMonitoring(interval) { sensorReadingInterval = setInterval(function() { io.emit('sensorReading', { temperature: sensor.getTemp() + 'C', humidity: sensor.getHumidity() + '%' }); }, interval); console.log('Climate control started!'); } function stopClimateMonitoring() { clearInterval(sensorReadingInterval); console.log('Climate control stopped!'); } return { start: startClimateMonitoring, stop: stopClimateMonitoring }; }...

socketio security issue and differences of socketio and long polling

node.js,socket.io
What are the security issues for the socket io in nodejs Which one is better for real time updation using node js. Either socket io or long polling....

socket.io app always refreshes on submit

jquery,node.js,express,socket.io
I installed socket.io into my app. However, when I press the submit button on my form, the page always refreshes. I've looked this issue up on Google and StackOverflow, tried several solutions (such as making sure my sockets code is within $(document).ready()... code etc.) but still no dice. I can...

socket.io Emit events firing multiple times

node.js,socket.io
I've read a few questions here on SO about this subject, but I'm not sure yet how to solve it in my case. The getMsgs emit event is firing as many times as I've accessed the /admin url. I know from other questions on SO that it is because the...

Need help understanding the following jQuery code in Socket.io(node.js)?

javascript,jquery,node.js,socket.io
html file <script> var socket = io(); $('form').submit(function(){ socket.emit('chat message', $('#m').val()); $('#m').val(''); return false; }); socket.on('chat message', function(msg){ $('#messages').append($('<li>').text(msg)); }); </script> io.on( "connection", function(socket) { console.log( "A user connected" ); socket.on('disconnect', function(){ console.log('user disconnected'); }); socket.on('chat message', function(msg){ console.log('message: ' + msg); }); socket.on('chat message', function(msg){ io.emit('chat...

Is it possible to use (or include) node.js framework in a Google Chrome Extension?

javascript,node.js,google-chrome,google-chrome-extension,socket.io
I don't want to create a chrome extension ONLY using node.js. I know chrome extensions use HTML, CSS and JavaScript. But I want to make a chat application as a chrome extension. I found that using MEAN stack along with socket.io for a chat application is the latest way and...

How to run socket.io and express on the same elastic beanstalk instance?

node.js,express,socket.io,elastic-beanstalk
We have and elastic beanstalk instance, we have some rest services and socket.io too. express is being started ad port 80. I started socket.io at 3001. but unable to connect this socket. I have also switched off the proxy, from nginx to off. code for socket is as below var...

How to listen for Room events

javascript,node.js,sockets,socket.io
So to clarify, I know the client should send a message such as 'join-room' to the server for handling, and thats fine, and I know I can do the same for 'leave-room'. What I want is to actually listen to the events themself, because say if a client disconnects, I...

Is users socket id a critical information? (security point of view)

javascript,websocket,socket.io
I'm using socket.io to build a chat application. Is it ok if clients receive the socket id of their interlocutors in terms of security? Can the client do something with this information? My assumption is no as only the server can emit message to other clients but I'm new to...

Socket.io AngularJS Error 403 - Forbidden

angularjs,get,socket.io,chat,http-status-code-403
I have an App on AngularJS but when I try to integrate Socket.io to a Chat, it gave me a problem... so here it is: GET http://localhost:2772/socket.io/?EIO=3&transport=polling&t=1433165408651-0 403 (Forbidden) Its on socket.io-1.3.5.js library An the principal error its here xhr.send(this.data)}catch(e){... Anyone knows what is the problem?...

Socket.io issue with express static path join

node.js,sockets,express,socket.io
I am trying to configure socket.io into a node application but i have an express static path: app.use(express.static(path.join(__dirname, 'public'))); On the client side the socket.io request looks like this: var socket = io.connect('http://MyIP:6969/lanmode'); On header i have the script link declared propertly extracted of CDN. That generates an error 404,...

Testing a Socket.io app, in which two connections interact

javascript,node.js,socket.io,mocha
I'm very new to unit testing for NodeJS, right now i want to test a socket.io server using Mocha, the app involves the interaction of 2 sockets, the spec is the following var expect = require('expect.js'); var io = require('socket.io-client'); describe("Server", function() { var options = { transports: ['websocket'], 'force...

socketio javascript confusion

javascript,variables,socket.io
I have seen a few examples of socket.io.js. On the client side the call to create the connection is always var socket = io.connect(); However, this is just creating a point to a function. How is this enough without another line calling socket? Is this not just a variable declaration?...

connect event is not firing

javascript,node.js,socket.io
I am very new to socket.io, node.js, and javascript in general. I am building a real-time web application with a partner for a summer research project. My question: Am I able to have a 'connect' event and a 'connection' event on the server side? I have not been able to...

How to defer reading until writing is done?

javascript,node.js,mongodb,websocket,socket.io
I'm making a multiplayer game using node.js, socket.io and MongoDB. When a player die they can reload the browser just before the fatal hit and still be alive even though the kill was registered. I'm using the following solution to save/load a player: socket.sockets.on('connection', onSocketConnection); function onSocketConnection(client) { util.log('New player...

Using Node.JS With ASP.NET WebForm and Socket.IO

asp.net,.net,node.js,socket.io
The first question I have is, is it possible to use Node.JS and Socket.IO inside of a ASP.NET webform and .Net web application? What I am trying to do is show real-time data, and I want to do this using node.js modules. I understand the client side code for node.js...

XSocket client with Socket.IO backend?

c#,mono,socket.io,xsockets.net
I was wondering if it's possible to use XSocket as a client and Socket.IO as the server side. I was pretty sure that it wouldn't work but then I read this post, which is effectively the opposite of what I'd like to do. and that seems to work. The major...

Using raphael.js to draw an image with parameters sent through socket.io

javascript,image,socket.io,raphael
This is what I have tried so far. socket-server.js var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); var config = require('./config2.js'); app.get('/', function(req, res){ res.sendfile('socket-client.html'); }); io.on("connection", function (socket) { var mapRes = {width : 720, height: 1040}; socket.emit("mapRes", mapRes); }); http.listen(3000, function(){ console.log('listening on *:3000');...

socket.io performance one emit per database row

mysql,node.js,socket.io
I am trying to understand what is the best way to read and send a huge amount of database rows (50K-100K) to the client. Should I simply read all the rows at once from the database at the backend and then send all the rows in a json format? This...

Run app on newest versions of Socket.IO gratter than 1.0

node.js,socket.io
I need some help to make a code writed to Socket.IO < 0.9 works with newers versions, like 1.3: var port = 843; var io = require('socket.io').listen( port ); io.enable('browser client minification'); // send minified client io.enable('browser client etag'); // apply etag caching logic based on version number io.enable('browser client...

adding websockets to existing php application

php,ajax,node.js,websocket,socket.io
I have an php framework which supports me building websites and allows me to edit the content directly in the frontend via inline editing. I have kind of an api, which receives the updates via an ajax call. So far i was the only one using it, but in the...

Socket.io client does not connect to server

node.js,express,socket.io
I am trying to make a Node.js app that will have an embedded chat. I am using socket.io to create that chat. I have attempted to set up my server / client, but the client does not seem to be connecting. I have my application to set log when sockets...

Socket.IO/Node.JS execution

javascript,node.js,sockets,browser,socket.io
I'm new to both Node.JS and Socket.IO, so I decided to pick up a simple chat client as my first project. To my knowledge, it structured correctly, but I'm being thrown an object expected error whenever I try to run index.js. Anyone know what's up? (if it helps, I'm running...

Triggering ng-show works only with ng-click event

javascript,angularjs,socket.io
I want to bind a variable to ng-show and right now it works only with click event. For example i work with socket.io and i want that when server send a message to client, that variable changes and then triggers ng-show but its not work! only if i click and...

Socket.IO server not receiving message from client

node.js,socket.io,mocha,bdd,expect.js
I'm playing around with Node, Socket.IO and BDD by creating a chat application. During one of the tests, I get a timeout error stating: Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test. The affected test is it('#must be able to receive a message',...

How do I seperate Socket.io route code into different files

javascript,node.js,sockets,socket.io
Say you have a server.js like this: io.on('connection', function (socket) { var userDetails = {}; /* Connection (after login) */ socket.on('userData', function (userDetails) { users[userDetails.id] = socket; userDetails = userDetails; require('user-online.js').register(socket, userDetails); }); //Notification socket.on('sendNotification', function (users, notification) { users.forEach(function (y) { if(users[y] != null){ users[y].emit(notification); } }) }); socket.emit('newNotification',...

How to deploy a python project with Nginx?

python,nginx,socket.io,server
I have wrote a client.py and a server.py, they talk to each other with socket(not websocket) TCP connection.This is a C/S application. Now i want to use nginx to deploy the server, but i dont know how to do. I have look through some material about nginx, which is only...

Node.js - Socket.io io.emit() doing nothing

javascript,node.js,socket.io
I'm having a problem with my socket.io applicaiton, the io.emit(), and io.sockets.emit() straight up do not work, they do nothing, and return no error. I've provided here the most simplified version of the code I can make here. Server: var server = require('http').createServer(); var io = require('socket.io')(server); var port =...

can i get ip address for free account on heroku

heroku,socket.io,web-hosting
I want to deploy chat app made in socket.io on heroku's FREE ACCOUNT It works fine with local ip - 127.0.0.1. It works fine with Static Ip - ...... but now i want to deploy app on FREE ACCOUNT made on heroku heroku gave me url : https://pure-savannah-3208.herokuapp.com/ And in...

Angular Conditional Routing

angularjs,node.js,express,socket.io
I am working on a somewhat simple chat app to familiarize myself with node/angular, but am typically a PHP developer. What I'm trying to do right now is make it so that if someone were to go to a room that does not exist, they would receive a page with...

Why I got so many connection events on Node's HTTP server?

javascript,node.js,http,websocket,socket.io
I have a web application using socket.io. It runs on localhost:8000 on my local machine. In order to find an annoying resource leak in my application, I tried to log out the connection events on my HTTP server: server.on('connection', function(conn) { //log out connection details }); When I open the...

Socket.io only emitting to current user

javascript,angularjs,node.js,sockets,socket.io
I'm testing Socket.io in a basic app, but io.sockets.emit does not seem to be working as expected. Below is my relevant server-side code, Angular socket service, and controller. When I run this code only the current connection sees the console.log statement. Based on io.sockets.emit I would have expected the opposite...

How to separately assign data to each connected user inside Socket.IO?

mysql,node.js,websocket,socket.io
I am trying to make a card game using Socket.IO, and I am having problems assigning user-specific data (in my case, the cards that each user has). I'm familiar with JavaScript, but I'm just not sure about whether or not there is a specific feature in Socket.IO for assigning user-specific...

Sails js subscribe to model changes scoped by groupid attribute

javascript,socket.io,sails.js,publish-subscribe
I have a model named Groupfeed which looks like this module.exports = { schema:true, attributes: { groupid: { model:'groups', required:true }, postid: { model:'post', required:true }, objectid: { model:'objects', required:true }, } }; On the client side I can subscribe to the Groupfeed model using io.socket.get('/groupfeed') which is done automatically...

How to improve nodejs / socket io performance?

javascript,node.js,performance,websocket,socket.io
I have set up a server for a little game. The clients send their movement data in a certain interval to the server. The server sends data about the other players, also in a certain interval, to the clients. If I add more players, the performance gets worse. How can...

Deleting namespace in Socket IO

node.js,namespaces,socket.io,typescript
This question has been asked before here, but I've implemented the answer and the problem has persisted. I'm working in typescript and I have a Room class that encapsulates a namespace (among other things), and a RoomManager class that maintains a list of rooms. I recently added functionality where a...

Socket.io server in the browser

javascript,coffeescript,socket.io
I want to use socket.io server in the browser. Why do I need this? I have a difficult real-time app which connected through websockets, but I want to manually test it through web page (send & receive the signals). How can I do that? P.S. Packages like mockSocket aren't feet...

optional autetification for socket.io

socket.io,jwt
I use socket.io-jwt library, with a code like: socketio.use(require('socketio-jwt').authorize({ secret: config.secrets.session, handshake: true })); But this restricts unauthenticated. I need authentication is optional, and has way to check after if you is logged or not. There is some library?...

Using WebRTC with Socket.io

socket.io,webrtc
I'm trying to create an app for making audio calls in the browser. I found this tutorial and started using it as a basis: https://www.webrtc-experiment.com/docs/WebRTC-PeerConnection.html After some tweaking to fit my needs. I ended up with the following: var iceServers = [ { url: 'stun:stun1.l.google.com:19302' }, { url: 'turn:numb.viagenie.ca', credential:...

NodeJS - Socket.io allowing only JWT verified connections

javascript,node.js,socket.io,jwt,express-jwt
My code is that simple: /*global require module process console*/ /*eslint-disable*/ (function (require, process) { 'use strict'; var config = require('../config') , uuid = require('node-uuid') , crypto = require('crypto') , fs = require('fs') , port = parseInt(process.env.PORT || config.server.port, 10) , serverHandler = function (req, res) { res.writeHead(404); res.end(); }...

How to listen for a socket update on the logged in user in all pages in Sails.js?

javascript,node.js,sockets,socket.io,sails.js
I have a Sails.js app. There is a selection for current settings in each page (set in layout). I need to be able to listen on all pages for a current changed event and notify the user to refresh the page. Can I call io.socket.on('currentChanged') in the client side and...

socket.io How Can I Get “Socket object” list in room

node.js,socket.io
folks. So far, I have been searching "How can I get socket list in room". I was able to find a lot of results. like this link. How to get room's clients list in socket.io 1.0 example, console.log(io.nsps['/'].adapter.rooms); But, That answers can get the socket list in room not "Object"....

Can I stream microphone audio from client to client using nodejs?

javascript,node.js,socket.io,web-audio,socket.io-1.0
I'm trying to create a realtime voice chat. once a client is holding a button and talks, I want the sound to be sent over the socket to the nodejs backend, then I want to stream this data to another client. here is the sender client code: socket.on('connect', function() {...

How to pass nginx proxy url for socket

node.js,sockets,nginx,proxy,socket.io
I am using socket in my application,i want to pass socket connection url from nginx as proxy url.I am doing it like that My socket code var socket = io.connect('/explorer/socket',{ 'reconnect': true, 'reconnection delay': 500 }); My nginx conf location /explorer/socket { proxy_pass http://xxx.xxx.xx.xxx:3000; } but it is not working,it...

Using socket io to add a marker to a google map when a new user logs in

javascript,node.js,google-maps,sockets,socket.io
I have a google map that is geolocating the user and placing a marker on the map. I am wanting A new marker to be added when a new user loads the map. To do this I am using socket io. However the desired result is not happening! Users and...

SailsJS - using sails.io.js with JWT

socket.io,sails.js,jwt,express-jwt
I have implemented an AngularJS app, communicating with Sails backend through websockets, using sails.io.js. Since the backend is basically a pure API and will be connected to from other apps as well, I'm trying to disable sessions completely and use JWT. I have set up express-jwt and can use regular...

socket.io - error after upgrade

javascript,node.js,socket.io
i was using socket.io with the 0.9.16 version and when i upgraded it, io.sockets.socket doesn't work io.sockets.socket(usernames[usr]).emit('event', msg, username); this "socket" doesn't work in socket.io 1.3.5 i have this error Missing error handler on `socket`. TypeError: Property 'sockets' of object #<Server> is not a function at Socket.<anonymous> (E:\xamp\htdocs\connexion\test_server_2.js:260:8) at Socket.emit...

Need to parse live json file using Socket io

json,node.js,parsing,socket.io
First a Heads Up! I am very new to the world of node.js and socket.io I have a json file which contains following data for example:- { "football": { "id": 1, "home": "Liverpool", "away": "Chelsea", "score": "1-0", "last scorer":"Gerrard" } } This file is updated live on few seconds basis....

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

javascript,node.js,socket.io
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) indicate that a message should go to a specific...

socket.io vs RethinkDB changefeed

socket.io,rethinkdb
Currently I'm using socket.io without RethinkDB like this: Clients emit events to socket.io, which receives the events, emits to various other clients, and saves to the db for persistence. A new client connecting will get existing data from the db then listen to new events over socket.io. How would switching...

Get error : [$injector:unpr] Unknown provider: socketProvider <- socket <- LogCtrl

angularjs,node.js,socket.io
I am new to AngularJs and nodejs and I have a simple chat app with angular as client and socketio as server side. I got an error when loading angular page Error: [$injector:unpr] Unknown provider: socketProvider <- socket <- LogCtrl My client side <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.min.js"></script> <script src="http://localhost:1337/socket.io/socket.io.js"></script>...

Socket.IO Fake a socket

express,socket.io
Background: I'm using the full Express, http.Server, and Socket.IO to make a game. When each person connects, they have a socket session and I use that to send information between server and client. What I would like to do now is to add AI to my game, since there is...

Polling interval for xhr for socket.io 1.0

javascript,socket.io
How do I set the polling interval for xhr fallback for socket.io 1.0? It looks like it polls every second when not in websocket mode but I'd prefer if the polling interval is every 2 seconds to reduce load on the server. I read through the documentation for both socket.io...

How to get ip in socket io

node.js,express,socket.io
var app = require("express")(); var server = require("http").Server(app); var io = require("socket.io")(server); var requestIp = require('request-ip'); server.listen(3000); var ipMiddleware = function(req, res) { return requestIp.getClientIp(req); }; var ip = null; app.get("/", function (req, res) { ip = ipMiddleware(req, res); res.sendFile(__dirname + "/index.html"); }); io.on("connection", function (socket) { // send the...

angularjs not using $rootscope and $broadcast

javascript,angularjs,socket.io
So basically I'm trying to find a way to prevent using $rootscope ,$broadcast and $apply. Let me show you the code first: app.controller('firstController', function ($scope, ServiceChatBuddy, socketListeners){ $scope.ChatBuddy = ServiceChatBuddy; $scope.$on('user delete:updated', function (event, id) { $scope.ChatBuddy.users[id]['marker'].setMap(null); delete $scope.ChatBuddy.users[id]; }); $scope.$on('loadPosition:updated', function (event, data) { $scope.$apply(function () { $scope.ChatBuddy.users[data.id] =...

Ajax or Websockets for small transmissions

javascript,html,ajax,websocket,socket.io
Im building a Chat website that uses Websockets(Socket.io) to send and receive messages to the server. In fact my website should use Websocket and now my problem is that for other transmissions like checking username at login or fetching JSON and updation DOM and other stuff, Can i use the...

Use socket.io-client with Express and nodejs to send query to java server

node.js,express,socket.io
I have a web app built upon Express. The nodejs backend is using a java server to perform some heavy operations. The dialogue between Express and the java server is done using socketio. The nodejs server is the client and uses socket.io-client to send queries to the java server. The...

Authentication in Socket.io

node.js,sockets,socket.io
I'm going to try to authenticate a connection on socket.io. Currently, the user is first authenticated via a REST API, then, I send the user a JsonWebToken with the authenticated user's username. After I open the connection between the client and the server, my plan is to temporarily delete that...

Socket.io error in sending arrays

javascript,arrays,object,socket.io
I have 3 variables to send to the client using socket.io, namely, mapRes & location. server.js var mapRes = {width : 720, height: 1040}; var location = [{x:100,y:100,z:100},{x:200,y:200,z:200}]; var obj = {'1':{x:100,y:200}}, '2':{x:200,y:100}}; io.on("connection", function(socket){ socket.emit("mapRes",mapRes); socket.emit("location",location); socket.emit("object",obj); } client.html socket.on('mapRes',function(message){ var mapRes = message; console.log(mapRes); }); socket.on('location',function(message){ var location...

sails.js how build real time web console app

javascript,node.js,socket.io,sails.js
I'm new to sails.js, I only know the basics and am able to build simple MVC app. My boilerplate app: https://github.com/JerryYangJin/zero I want to use sails.js to build a real time web console app. The app works like this: 1. user types command in web browser 2. sails(socket.io) to call...

How do I check the version of socket.io and update it

socket.io,socket.io-1.0
how can I check the version of socket.io that I am using ? and how do I update it if there is new release. Thank you in advance....

[Node.JS Socket.io]communication between two targeted sockets

node.js,socket.io
I'm currently working on a small node.js game. Game supposedly has a global chat, with a "logged in" list to challenge people. For the chat and the logged in list, i'm using the default socket.io room/namespace. I successfully send the challenge request with following code // When a user sends...

how to add custom data with sails.io handshake query

socket.io,sails.js,socket.io-1.0,sails.io.js
I would like to send a custom query variable during initial connect by sails.io on client. I added io.sails.query = "token=fdbfdsjf"; after including the sails.io.js but I don't see it in the handshake data on server, which was: query: { __sails_io_sdk_version: '0.11.0', __sails_io_sdk_platform: 'browser', __sails_io_sdk_language: 'javascript', EIO: '3', transport: 'polling',...

node.js iisnode https 500 HRESULT 0x6d subStatus 1013

node.js,iis,socket.io,iisnode
I'm currently working on a realtime chat with socket.io and node.js. On my development machine everything works fine. I can call my socket.io-server on port 888. The same port is free and reachable on my production server. I can't figure out why IIS raises an 500 error. Has anyone an...

Sails.js sockets. Good and bad sides. Difference with socket.io

javascript,node.js,sockets,socket.io,sails.js
So I am learning Sails.js at the moment and more specifically the integrated socket functionality of the framework. I do like the framework because it is very good for building APIs. My question is can you guys give me some comparison between socket.io and the sails sockets. I mean good...

Design pattern as alternative to front-end template locals

node.js,express,socket.io
I am relatively new to web development and am trying to figure out how to publish the server environment (dev, test, prod, etc) to the front-end. I am using Node.js with Express, but the following code is closer to pseudo-code because is this is more of a design pattern question....

Django, socket.io, node.js - Manage private messages and group conversations

django,node.js,websocket,redis,socket.io
I am in the process of writing a back-end for a service such as Facebook Messenger or WhatsApp. I started out following this splendid tutorial: http://www.maxburstein.com/blog/realtime-django-using-nodejs-and-socketio/ I do this with an API written in Python (Django). Along side with this API, I have a Redis process and a node.js server...

jQuery function on click with Node.js and Socket.IO

jquery,node.js,sockets,socket.io
I've created a simple chat application as recommended (which works fine), but I'm having trouble figuring out how to launch a jQuery-function across web sockets with Socket.IO. For example, I have a button to click: <button id="button"> Click me! </button> I would like my the button to execute a function...

Making realtime datatable updates

node.js,socket.io,socket.io-redis
I built an app which consumes data from a redis channel(sellers) with socketio and push the data in realtime to the frontend. The dataset could contain up to a thousand rows so I'm thinking about using a datatable to represent the data in a clean way. The table elements will...

Can I use rooms in namespaces in socket.io

node.js,socket.io,socket.io-1.0,node.js-connect
I'd like to know whether I can use multiple rooms withing a namespace in socket.io. As far as I know you can use either namespaces OR rooms. My purpose is to have multiple unique instances of my application talking with other ones with this unique application through websockets with just...

Node.js+socket.io “RangeError: maximum call stack size exceeded”

node.js,socket.io
I am sending my html whole html document using socket.io event to nodejs server after processed my whole html document. But I am getting “RangeError: maximum call stack size exceeded”. I have tried to send some small html content to my nodejs server and it's send very smoothly but when...

Express JWT Error: Not enough or too many segments in socket.io initial auth

javascript,authentication,socket.io,jwt,express-jwt
During the initial handshake where a token and username are passed, I am catching this strange error-- { handle: 10, type: 'error', className: 'Error', constructorFunction: { ref: 11 }, protoObject: { ref: 12 }, prototypeObject: { ref: 3 }, properties: [ { name: 'stack', attributes: 2, propertyType: 3, ref: 3...

Load module using node.js require

javascript,node.js,express,socket.io
I'm pretty new to node.js and I've been stuck for quite a long time on a problem I can't solve. I'm building a node.js app using express and jade frameworks. The app has the standard skeleton, that's how looks the main directory : app.js bin npm-debug.log views node_modules package.json public...

Is Nginx + Node.js + Socket.io + SSL possible?

node.js,ssl,nginx,socket.io
I'm trying to run a socket.io chat app with nginx as proxy. It works fine when I connect to the server via http+port, but it doesn't work with https. I see user connected/disconnected events pass through, but no emit reach client or server. Here's my server .conf (nginx/1.4.6 Ubuntu) upstream...

NodeJS/SocketIO Socket will not emit

javascript,node.js,socket.io
I'm trying to 'emit' data to the server, but nothing is happening. The console says that I've connected, but it won't log anything whenever I try to emit the specific command. Clientside (JQuery/JS): var ip = ""; $.ajax({ url : "../host", success : function(result){ ip = result; } }); var...

Re-Register events in socket.io-client after reconnect

node.js,sockets,socket.io
I have an socket.io-client application which looks like this: var port = 1234; var host = "http://host.com"; var ioc = require( 'socket.io-client' ); var isConnected = false; var socket; connect(); function connect() { socket = ioc.connect( host + ":" + port); } socket.once( "connect", function () { isConnected = true;...

Socket.IO CORS request failed

angularjs,node.js,firefox,express,socket.io
I have my in the client side an angular module: angular.module('App') .factory('socketClient', function(socketFactory, Auth) { // socket.io now auto-configures its connection when we ommit a connection url var ioSocket = io('', { // Send auth token on connection query: 'token=' + Auth.getToken(), path: '/socket.io-client' }); return socketFactory({ ioSocket: ioSocket });;...

node.js Socketio and dynamic content

javascript,jquery,html,node.js,socket.io
I'm trying to make it so that when nodejs triggers something in an irc chat that a html page (Running on *:3000) will execute some JavaScript. When I try to achieve this, it runs through the code but doesn't execute showDiv(); I'm running this in chrome with localhost:3000 open. Why...

Convert jquery to javascript with socket.io

javascript,jquery,socket.io
How can I convert jquery code into pure javascript. I am using the socket.io library. var socket = io("localhost:3000"); $('form').submit(function () { socket.emit('chat message', $('#m').val()); $('#m').val(''); return false; }); socket.on('chat message', function(msg){ $('#messages').append($('<li>').text(msg)); }); ...

How to circumvent the ES6 Class scoping issue with 'this' key word [duplicate]

javascript,socket.io,this,ecmascript-6
This question already has an answer here: How to access the correct `this` / context inside a callback? 4 answers How do I write a named arrow function in ES6? 1 answer For example in the Class constructor: Socket.on('user:join', onUserJoin); 'onUserJoin' is declared as a method of the class...

ReferenceError:room is not defined, RTCpeerconnection not working. Clients do not connect

javascript,node.js,socket.io,webrtc,node-static
I am making a WebRTC video chat application and it was working before i started to add or subtract more code and in the process i deleted or changed the order in a way that now i am getting this error. Sadly i don't have a backup code and it...

what is Socket-IO's heartbeat mechanism?

javascript,socket.io
I was reading on web sockets 'Ping/Pong'. web-sockets used this messages as heartbeat. since socket-IO internally uses web-sockets, my question is this, does socket-IO use same 'ping/pong' messages as heartbeat or there is some other mechanism for that? if socket-IO uses ping/pong messages to check the connection, than what socket-IO...

Socket.io passing javascript object

javascript,node.js,sockets,socket.io
I'm trying to pass a javascript object with socket.io. Client side var cPlanes = {}; //stands for client Planes var plane = new Plane(x, y, z, model, name); //A plane object I made filled with stuff cPlanes[nickname] = plane; //Nickname is defined elsewhere socket.emit("send planes", cPlanes);//socket is defined elsewhere too...

Socket.io Multiple returns for a single event

javascript,socket.io
I have a problem with code I copied directly from socket.io website. I have the server setup and it's running fine. The problem is it's duplicating each event after the first event fired: I read here: Socket.io message event firing multiple times That it's because of the events re-registering each...

How to emit websocket message from outside a websocket endpoint?

python,flask,websocket,socket.io,flask-socketio
I'm building a website using Flask in which I also use Websockets using Flask-socketIO, but there's one thing I don't understand. I built a chat-functionality. When one user sends a message I use websockets to send that message to the server, after which I emit the message to the other...

Redirect an octet stream in Apache using PHP or Django

php,python,django,apache,socket.io
I have a webserver which serves the client with an octet stream on port 20000 (it's actually a socket.io server hosted with node.js). This is running on a shared hosting account with a regular Apache server running on port 80 (this cannot be turned off, hence the socket.io server is...

Rooms are not removed after everyone leaves

node.js,socket.io
As far i read from the doc that Rooms are left automatically upon disconnection and they are automatically removed when everyone leaves. But this is not the case of my actual code: io.on('connection', function(socket) { socket.join(MainRoom); io.sockets.adapter.rooms[socket.id].owner = socket.username; //send the list of available rooms on connection socket.to(MainRoom).emit('updateList',io.sockets.adapter.rooms); socket.on('getUpdateList',function() {...