-
Notifications
You must be signed in to change notification settings - Fork 74
master and localsocket
websocket is used for generale use, localsocket and master are used for advanced use.
"websocket" creates server socket support websocket protocol.
"localsocket" creates server socket with telnet protocol.
"master" connects to "localsocket" with telnet protocol.
telnet is used for a simple internal communication between scripts
-
master-worker https://github.com/morozovsk/websocket-examples/tree/master/chat2
master.php create server socket with telnet protocol on port "localsocket"
worker.php create server socket with websocket protocol on port "websocket", also it connects to socket "master"
i.e master.php:localsocket = worker.php:master
worker.php receives data from "websocket" and sends data to the "master".
master.php receives data from "localsocket" and forwards data to other workers.
worker.php other workers receives data from "master" and forwards data to "websocket".
-
websocket-database
websocket.php create server socket with websocket protocol on port "websocket", also it creates server socket with telnet protocol on port "localsocket"
database.php connects to socket "master"
i.e websocket.php:localsocket = database.php:master
websocket.php receives data from websocket-clients and sends data to the "localsocket".
database.php reads asynchronously from "master" data, does synchronously query to database and sends asynchronously result from database to "master".
websocket.php reads asynchronously from "master" data and sends to "websocket".