I am making an ios chat application. After studying the necessary technologies and protocols, I decided to try websockets. For reasons, our top stack is based on php, and I learned about ratchet as websockets for PHP. I made a simple chat server for ios front-end from reading documentation . Chat works very well, and it’s also convenient for me. I wanted to know how to create separate private chats. Will a separate instance of the socket event loop run for individual rooms?
The sample server I created uses a single event loop to manage user connections and send messages to various connection / user IDs. I really tried to look for private chats, but did not find any information where I could be confident. Do I need to manage each connection / user ID in almost this event loop, for example, to decide which users can communicate with each other directly by controlling the sending of messages? Or is their really a separate way to do this? This is an example of an event loop as a pair of documentation that I implemented:
require dirname(__DIR__) . '/vendor/autoload.php';
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Chat()
)
),
8080
);
$server->run();
, ios/android -/. - , , , , , , .
,