These are chat archives for oncesk/yii-node-socket
we can create something like a
and all income connection will note to connect to any room, before connect we should login in some channel or room
sorry, but today i am tired and i can not create some diagrams =( but i can now explain main principles:
Node set up process:
Every node has configuration as ip(domain) and queue for listen in gearman is a callback function name. This configuration we are store in db. When new instance is setting up it configuration should be updated. Every worker can read nodes configuration and update it every 5 min for example, when we need to send data to all clients we must send it to all nodes to their callbacks (in gearman). Why? Because we can have two clients: John and Sara, John and Sara in room for example megaroom, but john connected to server 1 and sara connected to server 2, when john send message to sara sara situated in other server we must send message to Sara. This problem can be decided by sending message to all nodes in concrete channel.
Worker language can be php,nodejs,c,ruby and etc
Authentication and Authorization:
I think the simplest way to do authorizaation is a store channel, subscriber, and channel subscriber like in yii-node-socket.
Usecase: backend like a php can create some channel and can create some subscribers, can subscribe some subscriber to channel with the project business rules.
In this case we can have some connections which not be in some channel, this is not authenticated connections and can listen public channel.
For authorization we should store session id in cookie and in session, the best way to do that it is use a dedicated store like redis for session. As a minus in some cases we are need to open web session in our worker in this case, as i see, we can do that.
Send event from php (language for example):
For send message to all clients we should already set task to all queues with some data and that is all what we should do for send message.
We need to write abstract php code - standalone library which can be used for adapt tool for frameworks. Yii,yii2, symfony2 and etc...
With this system we can:
I am open for discussion and proposal. I really do not know if something exists for the web.