expressif / socket
Sockets implementation using Expressif streams
0.0.5
2015-01-28 21:02 UTC
Requires
- expressif/stream: 0.1.0-rc2
This package is not auto-updated.
Last update: 2024-11-09 17:30:03 UTC
README
Sockets implementation using Expressif streams
usage :
<?php require 'vendor/autoload.php'; use Expressif\Socket\Server; use Expressif\Socket\Client; $endpoint = 'tcp://127.0.0.1:1337'; echo "Starting the server at $endpoint\n"; $server = new Server($endpoint); $server->on('connection', function($client) use() { $client->on('data', function($name) use($client) { $client->write('Hello '.$name)->close(); }); }); $c = new Client($endpoint); $c->send('James Bond')->on('data', function($greetings) { echo "<< $greetings\n"; });