Socket.IO

Socket.IO on controller

可紊 提交于 2020-01-24 20:47:07
问题 I'm pretty new to sockets and I've been struggling to implement some of the documentation i've seen online. This is my set up currently and I wanted to run socket.io against just the healthcheck api endpoint (/api/v1/healthcheck) how would I go about running socket io in the healthcheck controller? and emit changes to the response? Any help is appreciated, i'm tearing my hair out :( Server.js const socket = require('socket.io') const healthcheck = require('./routes/healthcheck'); const auth =

rxjs: how to order responses via Observables

心不动则不痛 提交于 2020-01-24 17:44:25
问题 I am using socket.io to send a series of responses to my front-end. The responses are intended to be sequential, but depending on the connection created by socket.io they're not always guaranteed to come in the correct order (https://github.com/josephg/ShareJS/issues/375). Assuming each response had a sequence field that held a number (shown as the number in the picture above), the observable should emit these responses in order. If a response is received out of order and a certain amount of

Cannot get more than ~980 connections with Socket.io and Docker

一世执手 提交于 2020-01-24 14:09:10
问题 I am unable to scale my simple Socket.IO app past around 980 concurrent connections using Docker. However, if I run it locally on my macOS Sierra 10.12.6 I can get over 3000 connections. I have included this repo of a simple SocketIO application that I am testing with: https://github.com/gsccheng/simple-socketIO-app My Docker-for-Mac is configured at 4 CPUs and 5 GB memory. The Version is Version 17.09.0-ce-mac35 (19611) Channel: stable a98b7c1b7c I am using Artillery version 1.6.0-9 to load

Cannot get more than ~980 connections with Socket.io and Docker

萝らか妹 提交于 2020-01-24 14:06:49
问题 I am unable to scale my simple Socket.IO app past around 980 concurrent connections using Docker. However, if I run it locally on my macOS Sierra 10.12.6 I can get over 3000 connections. I have included this repo of a simple SocketIO application that I am testing with: https://github.com/gsccheng/simple-socketIO-app My Docker-for-Mac is configured at 4 CPUs and 5 GB memory. The Version is Version 17.09.0-ce-mac35 (19611) Channel: stable a98b7c1b7c I am using Artillery version 1.6.0-9 to load

How to handle socket.io disconnect by client by leaving page?

喜欢而已 提交于 2020-01-24 12:53:27
问题 I have a socket.io application with node.js and was wondering what possibilities exist to respond to a client simply closing their browser window. Is there anyway to know that this has been done? What kinda of signal can been sent to the server? If I don't have a way of doing telling if a particular client has disconnected what else can I do? 回答1: I have a socket.io application with node.js and was wondering what possibilities exist to respond to a client simply closing their browser window.

IIS: Websocket and IIS sharing port 443

痞子三分冷 提交于 2020-01-24 00:20:09
问题 Is it possible with IIS 7.5 to host a secure https website on port 443 and to have a Java app run Socket.IO websocket on 443 also? Currently we run the website on 443 and the secure websocket on another port 10001, but we are having issues with user firewalls and would like to move the websocket to a better "known default" port. I know that IIS 8 has WebSocket capability but we would perfer not to have to upgrade our server instances to server 2012 unless we must. 回答1: Two separate processes

Error setting TTL index on collection : sessions on socket reconnect

馋奶兔 提交于 2020-01-23 13:03:35
问题 I have a node app with mongoose and socket.io. app works fine but if somehow socket gets disconnected and while trying to reconnect following error is thrown. if i run this under forever, app will restart but after some time it will throw the same error and will go on in a loop. node_modules\connect-mongo\lib\connect-mongo.js:161 throw new Error('Error setting TTL index on collection : ' + s ^ Error: Error setting TTL index on collection : sessions i tried other solutions found in SO but no

Getting socket.io namespace from anywhere in the project

喜你入骨 提交于 2020-01-23 12:36:07
问题 After my REST call and some database inserts I want to emit a new notification to the frontend via socket.io like this: socket.broadcast.emit('send notification', notification); Since the function I'm doing this in was triggered via REST and not via socket.io I don't have the variable 'socket'. I thought at first I can just get 'io' like: var io = require('socket.io') // or like: require('socket.io')(3000) from here I thought I can get the namespace like: var nsp = io.of('/notification-list')

Wait for socketio event inside express route

非 Y 不嫁゛ 提交于 2020-01-23 02:37:07
问题 I'm using express,socketio and socketio-client in my application. (I not very comfortable with nodejs stack...) to summarize my application flow : Client => node/express API + Socketoi server <=> nodejs (Socketio-client) browser send request to a nodejs/express (route /api) Do some request headers overwrites with middlewares In the route '/', server sends an emit to a nodejs (Socketio-client) after executing some logic, socketio-client emit an event with the logics result I need this result

socket.io Emit events firing multiple times

放肆的年华 提交于 2020-01-23 01:57:06
问题 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 listener is registering every time I visit the admin page, but I'm not sure how to refactor my code (ie where to move the io.on(..) and how to call it from the router.get('/admin'..) function. router.get('/admin', function(req, res, next){ io.on(