Socket.IO

Using the same redis.createClient() instance for publish and subscribe

情到浓时终转凉″ 提交于 2019-12-23 18:21:45
问题 I'm working with redis to publish and subscribe messages between socket.io clients, when client connects to the server ( io.sockets.on('connection', function(socket){...}); ) i'm creating a subscribe variable using redis.createClient() and then using the subscribe function to subscribe the client to channel. My question is if its right to use the same subscribe variable to do a publish action? or it's important to create another instance with redis.createClient() for publishing messages so i

cannot keep socket connection when screen off in android

倖福魔咒の 提交于 2019-12-23 18:06:52
问题 I have trouble to keep socket connection in android. I use Socket.IO-client java library in my application. The socket connection is keeped when screen on. but, if screen off, the socket is disconnected caused by ping timeout. how can i solve this problem? I open connection like this. private static final String EVENT_CONNECT = Socket.EVENT_CONNECT; private static final String EVENT_MESSAGE = Socket.EVENT_MESSAGE; private static final String EVENT_DISCONNECT = Socket.EVENT_DISCONNECT; private

socketio client silently loses connection and creates new socket (transport close)

白昼怎懂夜的黑 提交于 2019-12-23 17:56:38
问题 I'm working on a threejs animation that is recorded with ccapture it depends on each client having a single connection to the node backend, which receives a 'render-frame' socket event. This works for a while, but after a few minutes, the client, without error-ing out, closes the connection silently, and then creates a new connection, thus losing the first initial socket connection. I keep the window open the entire time and in focus. my socket debug logs show the following. It always works

Django & node.js : throw arguments[1]; // Unhandled 'error' event

本小妞迷上赌 提交于 2019-12-23 17:52:04
问题 I am giving a try to the Django socket.io and node.js example by Realtime Django when I am trying to send the message from a browser I am getting the error from node server that is events.js:71 throw arguments[1]; // Unhandled 'error' event ^ Error: connect ECONNREFUSED at errnoException (net.js:770:11) at Object.afterConnect [as oncomplete] (net.js:761:19) Since I started with node.js and socket.io I am not able to figure out this error. Please tell me what might I am doing wrong. Also some

trying to connect to node.js and socket.io 0.7.2 from iphone

若如初见. 提交于 2019-12-23 15:16:51
问题 as the question says, i'm trying to connect to the socket.io server from an app running on iphone/ipad. in another Q i found the link to achieve this with the help of https://github.com/fpotter/socketio-cocoa ... buuuut. it's not working anymore (socket.io 0.7.2). error messages i get are: socket.io warn - unknown transport: "undefined" client Connection failed with error: The operation couldn’t be completed. (WebSocketErrorDomain error 1.) downgrading socket.io to version 0.6.17 works but i

Creating a redis listener - possible in php?

大憨熊 提交于 2019-12-23 11:44:19
问题 I'm slowly digging in and learning redis in my spare time, and I am interested in the options available for creating a 'listener' for a website that subscribes to a channel, and updates a webpage as messages are received. Now, from my old actionscript days, and current javascript work, i'm quite familiar with the concept of listeners given those two languages. However, my server-side-programming-fu really only extends as far as PHP, a bit of rails, a bit of python, and pseudo node.js (i'm a

Message ordering in socket.io

陌路散爱 提交于 2019-12-23 09:39:30
问题 Does socket.io guarantee that on() callbacks will be called in the same order that the messages were emitted? 回答1: Node.js is a single event loop so yes. But you have another problem, think about the latency between you and your clients, if two clients sent their messages, the first message that came to the server will be handled first, so if the first client emitted his message but he had a higher latency to the server from the second client (which sent his message after the first client),

How can I get the referer for a socket.io connection

柔情痞子 提交于 2019-12-23 08:54:26
问题 I have a simple node.js web server and I use socket.io. The users can perform simple tasks on the server, which is a single page application running on / . If a user has an existing state on the server, the user's ID could be appended to the URL, e.g. /{my-id} . I need to extract the ID from the URL when a socket.io connection is established. Is it any way to get the URL for the client page where the socket is created from; the referrer of the connection request? 回答1: Using console.log I

How to check if socket still connected?

拈花ヽ惹草 提交于 2019-12-23 08:51:42
问题 I have a page on which users connect to my node server with socket.io but I only allow them to have one open socket.io connection to the server (by passing along their account id when authorizing them and storing it in an array) and this works fine 99% of the time. The problem is that sometimes when users disconnect, the serverside disconnect event doesn't fire for some reason, so I can't clear their account from the array of clients, which ends up with them being locked out. Is there a way

What is the difference between a session store and database

一曲冷凌霜 提交于 2019-12-23 07:38:54
问题 I've been trying to implement authentication and session management in a node.js application using socket.io. And from almost all the resources I found, I came across the term "session store". There are open source tools that handles sessions for us, but we have to provide them with a session store . Some tools has built in storage for sessions in memory, for example the module express-session comes with a default in memory session store, but also this warning: Warning The default server-side