Socket.IO

Using socket.io with express 4 generator

こ雲淡風輕ζ 提交于 2020-01-25 20:27:06
问题 New to node, so my apologies. I'm working on my app and I want to send the location using socket.io. I've found 1000 examples, but all refer to when express had no routes, and it all was at the app.js. All examples refer to chat applications. I was able to run an example piecing together several questions I searched but, I don't understand how to get the io that I finally got working on my app.js to interact with my index.js so I can use it with multiple emit parameters. express.io is

how to disconnect socket on session expire

邮差的信 提交于 2020-01-25 17:41:09
问题 I have a small express application this also contains the socket program. When ever user success login it creates the session and socket connection perfectly. But MY problem was when the express session expire or session delete by cookie manager, the socket still in the active connection. it receiving the messages. how to disconnect even if the session are not available after the success login. Here my code was: This is my html file which gets the alert message: <!DOCTYPE html> <html> <head>

how to disconnect socket on session expire

孤者浪人 提交于 2020-01-25 17:37:10
问题 I have a small express application this also contains the socket program. When ever user success login it creates the session and socket connection perfectly. But MY problem was when the express session expire or session delete by cookie manager, the socket still in the active connection. it receiving the messages. how to disconnect even if the session are not available after the success login. Here my code was: This is my html file which gets the alert message: <!DOCTYPE html> <html> <head>

Using socket.io on GKE with nginx ingress

拈花ヽ惹草 提交于 2020-01-25 10:18:13
问题 I'm trying to integrate socket.io into an application deployed on Google Kubernetes Engine. Developing locally, everything works great. But once deployed, I am continuously getting the dreaded 400 response when my sockets try to connect on. I've been searching on SO and other sites for a few days now and I haven't found anything that fixes my issue. Unfortunately this architecture was set up by a developer who is no longer at our company, and I'm certainly not a Kubernetes or GKE expert, so I

Node socket.io server crash when starts

孤街醉人 提交于 2020-01-25 08:52:06
问题 I have a socket.io server and a client runing correctly. Each time that the server is down, the client try to connect again each 5 seconds. When the server is up again they connect without problems. But the problem comes when I wait long time before up the server again, when the server is up, it crashes showing : info - socket.io started debug - client authorized info - handshake authorized DqN4t2YVP7NiqQi8zer9 debug - setting request GET /socket.io/1/websocket/DqN4t2YVP7NiqQi8zer9 debug -

why node js socket not working when change port to https?

不羁的心 提交于 2020-01-25 07:59:24
问题 Normally in app.js i use this code on port 3000 it's work good (on my-domain.com:3000 ). . http.listen(3000, function(){ console.log('start server on port :3000'); }); then i want to use on https , so i change app.js to http.listen(443, function(){ console.log('start server on port :443'); }); When run node app.js , it's show error events.js:160 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE :::443 at Object.exports._errnoException (util.js:1012:11) at exports.

Node.js minimal function for parsing route

半世苍凉 提交于 2020-01-25 05:37:05
问题 I have a Node.js / Express app working, that receives routes like so: app.get('/resource/:res', someFunction); app.get('/foo/bar/:id', someOtherFunction); This is great and works fine. I am also using Socket.IO, and want to have some server calls use websockets instead of traditional RESTful calls. However, I want to make it very clean and almost use the same syntax, preferrably: app.sio.get('/resource/:res', someFunction); This will give a synthetic 'REST' interface to Socket.IO, where, from

Socket.io Client side, is there a way to keep receiving data when lost focus on the broswer?

烂漫一生 提交于 2020-01-25 03:55:11
问题 is there a way to keep receiving data when lost focus on the broswer on Socket.io Client side? I'm making a multiplayer game test with html5 and nodejs as server, everything works fine, but i have the case that if the client (the game), lost the focus, for example move to another windows or tab, it stops receiving information, then when a i focus again a receive all the data on the queue 来源: https://stackoverflow.com/questions/28916859/socket-io-client-side-is-there-a-way-to-keep-receiving

Elephant.io Client not working

喜夏-厌秋 提交于 2020-01-24 23:46:46
问题 I've a socket.io based Websocket-Server which should get notifications from a php application. I found http://elephant.io/ which seems to be the right library for doing this. It seems that elephant.io is optimized for composer because i can't find any example for using it without them and by trying it on my own I get endless errors of includes files which are missing. So I installed composer the first time and the elephant.io packet in the folder lib\composer so all files of this library are

Socket.io client-side reconnect not working

怎甘沉沦 提交于 2020-01-24 23:30:23
问题 I'm using Socket.io to communicate between my Node.js server and the client website. Everything works great! Except one thing. I'm allowing the user to disconnect from Socket.io and reconnect later, or at least I'm trying to. Keeping in mind that my socket from calling io() is stored in mySocket, disconnecting works fine using mySocket.io.disconnect() . The server catches it, the client knows it's disconnected, it's great. The issue is when I try to reconnect later... So at first I just tried