Socket.IO

unable to deploy nodejs socket io application on openshift

穿精又带淫゛_ 提交于 2020-01-05 02:18:10
问题 I have a simple chat application based on nodejs and socket io. Works fine locally. But i am facing issues in deploying it to openshift. I have read and implemented almost all related threads on Stack Overflow. No progress yet. Client Side(index.html): <script src="/socket.io/socket.io.js"></script> var socket = io.connect("http://www.abcd.com:8000/"); where 'abcd' is an attached domain name to the openshift app. Server Side(index.js): //Express initializes app to be a funciton handler that

NodeJS - Creating empty array results in array with a lot of nulls

我与影子孤独终老i 提交于 2020-01-04 15:59:07
问题 I am creating a Node.js chat using socket.io The problem is that when I see the console.log of history I see an array with A LOT of nulls and at the end my history entries [null,null,null......[ { username: 'Nobody Example', message: '231', date: '03/21/2013 14:23:58' } ]] How come these nulls are in the array? Here is a part of my code. var history = []; io.sockets.on('connection', function (socket) { socket.on('send', function (message) { var date = time(); io.sockets.in(socket.room).emit(

Get SESSIONID in nodeJS

为君一笑 提交于 2020-01-04 14:31:31
问题 Now, after some hours of playing around with nodejs and socket.io, I'm getting a couple more problems - one being, that I need to get the sessionID inside node.js, whitout using app.get('/' ... - since that event doesnt seem to fire when socket.io connects, it only fires .on('connection', function( ... var express = require('express')() express.set('port', process.env.PORT || 8080) var server = require('http').createServer(express) var socket = require('socket.io').listen(server) server

Android library which works with scoket.io(1.0.4) using node js at server side

痞子三分冷 提交于 2020-01-04 14:20:48
问题 I am trying to connect Gottox (https://github.com/Gottox/socket.io-java-client) with socket.io (1.0.4)(http://socket.io/) but unable to connect I think Gottox doesn't work with latest socket.io. Is there any other Java/Android library that I can use to make socket connections between socket.io and android native application. I am using node.js at server side. 回答1: Looks like https://github.com/nkzawa/socket.io-client.java supports the latest socket.io 1.x version. I haven't tried it yet. 来源:

Socket.io 1.0.5 : How to save session variables?

旧时模样 提交于 2020-01-04 14:11:51
问题 Unfortunately socket.io developer team decided to deprecate functions set() and get(). The problem is that these two functions allowed us to save variable into session. So my question is : What is the equivalent of the folloing code on socket.io 1.0.5 ? socket.set('mySessionVar', 'myValue'); socket.get('mySessionVar', function (error, mySessionVar) { console.log('I have a super variable save in the session : '+mySessionVar); socket.emit('mySessionVar', mySessionVar); }); Thank you for your

Sails js subscribe to model changes scoped by groupid attribute

荒凉一梦 提交于 2020-01-04 12:45:34
问题 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 by the blueprint api and then io.socket.on('groupfeed',function(obj){console.log(obj)}) would give me updates on the model changes when I

How to test chat web app

北慕城南 提交于 2020-01-04 09:19:10
问题 I am developing chat application, using node.js socket.io module on a server, and javascript on a client. As it become more complex, I become tired to test different usage scenarios by clicking across browsers. At now I use different browsers in order to separate cookies. So in Firefox there is one chat participant, in Opera - second, etc. Therefore my question is: Can I automate this somehow? I've heard about headless testing engines like Phantom JS, Selenium WebDriver, but I don't know how

How to implement long polling with socket.io?

巧了我就是萌 提交于 2020-01-04 07:47:14
问题 Currently, i have created an application in node.js to send notification to all client using socket.io with mysql. So any change in my mysql database will be notified to the multiply clients through socket.io instantly. The application work charm. The problem i'm facing is related to performance issue. My browser get the constant push notification from the server, which slows down the performance of my browser. I/Client need to get the notification only on the database change, rest of the

socket.io - getting more than one field for a socket?

℡╲_俬逩灬. 提交于 2020-01-04 04:09:09
问题 I have the following code when a user disconnects. I want to emit a signal with the room name and user name. client.get('nickname', function(err, name) { client.get('room', function(err2, room) { io.sockets.in(room).emit('disconnect', name); }); }); My question is, is there any way to avoid wrapping the .get calls like this? For my application, they are going to add up quickly. Can I get more than one value from one get() command? Or am I just handling this all wrong? 回答1: If you need to get

Nodejs and socket.io for push notifications

ⅰ亾dé卋堺 提交于 2020-01-04 01:57:54
问题 I'm currently looking to offer push notifications to an iphone and android app I'm working on. I took a look at the push notification services and they are very expensive so, I'm looking to run my own using socket.io. I guess my question is, how demanding on the server are push notifications? Do I need a ton of bandwidth or some specific server setup? I haven't used push notifications before to estimate the amount I would need sadly. Currently I'm using Nodejitsu for my nodejs app and plan to