Socket.IO

Socket.IO confirmed delivery

做~自己de王妃 提交于 2020-01-12 14:30:42
问题 Before I dive into the code, can someone tell me if there is any documentation available for confirmed delivery in Socket.IO? Here's what I've been able to glean so far: A callback can be provided to be invoked when and if a message is acknowledged There is a special mode "volatile" that does not guarantee delivery There is a default mode that is not "volatile" This leaves me with some questions: If a message is not volatile, how is it handled? Will it be buffered indefinitely? Is there any

Using SignalR in ASP.NET Core 1.0

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-12 09:55:32
问题 We have an ASP.NET Core 1.0 RC1 application and we want to incorporate SignalR in it. However, SignalR is not yet a part of ASP.NET Core 1.0. Is there a way to still incorporate SignalR in our existing app or will we have to look into some other web sockets library such as socket.io? 回答1: Although SignalR 3 won't be a part of the 1.0 release of ASP.NET Core, you can still use SignalR in an ASP.NET Core web app project. In fact, check out this SignalR project on the official "aspnet" account

Using SignalR in ASP.NET Core 1.0

╄→гoц情女王★ 提交于 2020-01-12 09:51:26
问题 We have an ASP.NET Core 1.0 RC1 application and we want to incorporate SignalR in it. However, SignalR is not yet a part of ASP.NET Core 1.0. Is there a way to still incorporate SignalR in our existing app or will we have to look into some other web sockets library such as socket.io? 回答1: Although SignalR 3 won't be a part of the 1.0 release of ASP.NET Core, you can still use SignalR in an ASP.NET Core web app project. In fact, check out this SignalR project on the official "aspnet" account

How to get all the sockets connected to Socket.io

不羁岁月 提交于 2020-01-12 08:51:47
问题 I did some search here and found this answer // list all connected sockets var list = io.sockets.sockets; console.log("Connected sockets:"); list.forEach(function(s) { console.log(" socket.id = ", s.id); }); But because io.sockets.sockets; that mentioned there is NOT an array it doesn't work.so i have 2 questions : a)How can i access to all sockets connected? b)How can i access to sockets connected to specific room? Cheers PS:this question is asked before but those questions are out dated.

do I have to remove event listener when socket is disconnected?

ぐ巨炮叔叔 提交于 2020-01-12 06:56:50
问题 In socket.io, when the client is disconnected from the server the disconnect event is fired in the server for the socket. Do I have to removeAllEventListeners() from the socket $events ? Or does it happen automatically when the socket dies? I heard that memory leaks can be on the server if i don't do it ... 回答1: After digging through the socket.io source, the socket object (which is the EventEmitter) is deleted when the client disconnects so it is not necessary to manually call

Socket.io, difference between socket.set() and socket property?

半腔热情 提交于 2020-01-12 06:53:30
问题 Socket.io recommends settings per-socket variables like so: socket.set('foo', bar, function () {}); Variables can also be set and accessed on the socket: socket.foo = bar Is there a benefit to using the provided set() function? 回答1: Calling socket.foo sets your property on the socket object itself. This isn't recommended because you could be overriding an internal property that socket uses and depends upon. When you call socket.set() this is stored in an internal data structure that won't

Get user id socket.io, passport, koa

一世执手 提交于 2020-01-12 05:46:47
问题 I'm using Koa, Passport.js and koa-session to authenticate users. So it basically looks like: // session var session = require('koa-session'); app.keys = [config.secret]; app.use(session()); // auth require(__dirname+'/lib/auth'); // de/serializeUser, strategies etc.. var passport = require('koa-passport'); app.use(passport.initialize()); app.use(passport.session()); This works well. On requests I do have the req.user , with the user id. But when using sockets, I can do: io.on('connection',

chat application: node.js or APE?

别来无恙 提交于 2020-01-12 05:44:05
问题 I want to create a chat app which would use php/codeigniter to do the views and user interface. I've been reading lots of posts on stackoverflow which recommended node.js or socket.io. Yet I've also run across APE(Ajax Push Engine). I don't really know much about either and was wondering which to use. I read up on node.js and saw lots of good things about it, but the major thing about it that worries me is that it's relatively new and doesn't have lots of real world websites testing/using it.

How can a Phoenix application tailored only to use channels scale on multiple machines? Using HAProxy? How to broadcast messages to all nodes?

只谈情不闲聊 提交于 2020-01-12 05:24:06
问题 I use the node application purely for socket.io channels with Redis PubSub, and at the moment I have it spread across 3 machines, backed by nginx load balancing on one of the machines. I want to replace this node application with a Phoenix application, and I'm still all new to the erlang/Elixir world so I still haven't figured out how a single Phoenix application can span on more than one machine. Googling all possible scaling and load balancing terms yielded nothing. The 1.0 release notes

How can a Phoenix application tailored only to use channels scale on multiple machines? Using HAProxy? How to broadcast messages to all nodes?

让人想犯罪 __ 提交于 2020-01-12 05:23:10
问题 I use the node application purely for socket.io channels with Redis PubSub, and at the moment I have it spread across 3 machines, backed by nginx load balancing on one of the machines. I want to replace this node application with a Phoenix application, and I'm still all new to the erlang/Elixir world so I still haven't figured out how a single Phoenix application can span on more than one machine. Googling all possible scaling and load balancing terms yielded nothing. The 1.0 release notes