Consultant, Trainer, Contributor.
RFC6455 released in 2011
Full-Duplex: Client to server and server to client
« Just » a protocol, language agnostic
Only transfer data when useful ≠ polling
Different paradigm, different problems
Memory management, long running process, shared state between clients…
Retrieve sensor data,
Chat and social feeds,
Collaborative editing/coding,
Gaming…

WebSocket server and client written in PHP
Built using ReactPHP ecosystem
Event-driven,non-blocking I/Owith PHP
                            // 🤓 Low level libraries
                        
                        
                    EventLoop ?Waits for and dispatches events or messages.
                            $loop = React\EventLoop\Factory::create();
// Register streams to listen on
$loop->run();
                        
                        
                    Everywhere,for everything…
                            $stdin  = new React\Stream\ReadableResourceStream(STDIN,  $loop);
$stdout = new React\Stream\WritableResourceStream(STDOUT, $loop);
                        
                        
                    Two libraries: client and server.
                            # Server only
composer require cboden/ratchet
# Client only
composer require ratchet/pawl
                        
                        
                    Client must connect to Server
Client messages are sent to other connected clients.
Client can define his name to identify himself.
A bit different than the Request / Response model.
👉 Use tools like Supervisor or SystemD.
Do you really need Full-Duplex?
👉 For Server to Client only, check Server-Sent Events!
Sharing code,domain expertise,team knowledge…
@s_hulard
https://github.com/shulard/ipc-websocket-sample