cursedcoder / emessenger
Send messages to php process over protocols.
0.1
2016-04-13 05:06 UTC
Requires
- php: >=5.6
- concerto/comms: ~0.8
- cursedcoder/universal-serializer: ^0.1.0
- react/react: ~0.4@dev
Requires (Dev)
- phpunit/phpunit: ^5.3
This package is not auto-updated.
Last update: 2025-01-16 01:48:58 UTC
README
Send any messages across remote processes.
Available transports
- Unix socket files (unix://tmp/log.sock)
- More later: tcp, udp etc.
Examples
<?php // logserver.php use React\EventLoop\Factory as EventLoopFactory; use EMessenger\Transport\UnixTransport; use EMessenger\MessengerFactory; $loop = EventLoopFactory::create(); $transport = new UnixTransport($loop, 'unix://tmp/log.sock'); $messenger = MessengerFactory::server($transport); $messenger->send('debug', 'This is a test message.');
<?php // logwriter.php use React\EventLoop\Factory as EventLoopFactory; use EMessenger\Transport\UnixTransport; use EMessenger\MessengerFactory; $loop = EventLoopFactory::create(); $transport = new UnixTransport($loop, 'unix://tmp/log.sock'); $messenger = MessengerFactory::client($transport); $messenger->on('debug', function($debug) { echo 'Received debug message: ' . $debug; });