C
C
CarloMarlo2020-06-10 14:36:30
PHP
CarloMarlo, 2020-06-10 14:36:30

Daemons in PHP as forks, is it possible to forward a WS request to such a process?

There is a PHP daemon that spawns forks, which are essentially WS servers, how to access them knowing only the pid from the client, say when using JS, and is such a work model possible? If such a structure is not possible, then how can you implement the launch of a number of WS servers, each for processing its own range of clients?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Stalker_RED, 2020-06-10
@Stalker_RED

Run them on different ports?
you can specify some parameters when connecting

var ws = new WebSocket("ws://example.com/service?key1=value1&key2=value2");

M
MaLuTkA_UA, 2020-06-10
@MaLuTkA_UA

Look towards workerman, it should help you

A
Alexey Sundukov, 2020-06-10
@alekciy

Maybe. You must have a manager who, by the client's ID, will send his request to the desired server. The principles are about the same as for a distributed cache. There is a function that calculates the required cluster nodes, or there is a storage in which client connections with cluster nodes are stored.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question