Skip to content

Commit

Permalink
Remove use cases in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRotmann committed Jul 14, 2021
1 parent fc4d981 commit f2e98a8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Once [installed](#install), you can use the following code to create a simple
echo server that listens for incoming multicast messages:

```php
$factory = new Factory();
$factory = new Clue\React\Multicast\Factory();
$socket = $factory->createReceiver('224.10.20.30:4050');

$socket->on('message', function ($data, $remote) use ($socket) {
Expand All @@ -60,7 +60,7 @@ See also the [examples](examples).
The `Factory` is responsible for creating your [`SocketInterface`](#socketinterface) instances.

```php
$factory = new Factory();
$factory = new Clue\React\Multicast\Factory();
```

This class takes an optional `LoopInterface|null $loop` parameter that can be used to
Expand Down
7 changes: 2 additions & 5 deletions examples/dump-received.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
* Accepts a single argument socket address (defaults to 224.10.20.30:12345)
*/

use Clue\React\Multicast\Factory;
use Clue\Hexdump\Hexdump;

require __DIR__ . '/../vendor/autoload.php';

$address = '224.10.20.30:12345'; // random test address
Expand All @@ -18,9 +15,9 @@
$address = $argv[1];
}

$factory = new Factory();
$factory = new Clue\React\Multicast\Factory();
$socket = $factory->createReceiver($address);
$hex = new Hexdump();
$hex = new Clue\Hexdump\Hexdump();

$socket->on('message', function ($data, $remote) use ($hex) {
echo 'Received from ' . $remote . PHP_EOL;
Expand Down
4 changes: 1 addition & 3 deletions examples/echo-received.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* Accepts a single argument socket address (defaults to 224.10.20.30:12345)
*/

use Clue\React\Multicast\Factory;

require __DIR__ . '/../vendor/autoload.php';

$address = '224.10.20.30:12345'; // random test address
Expand All @@ -17,7 +15,7 @@
$address = $argv[1];
}

$factory = new Factory();
$factory = new Clue\React\Multicast\Factory();
$socket = $factory->createReceiver($address);

$socket->on('message', function ($data, $remote) use ($socket) {
Expand Down
4 changes: 1 addition & 3 deletions examples/send-once.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
* Accepts a single argument socket address (defaults to 224.10.20.30:12345)
*/

use Clue\React\Multicast\Factory;

require __DIR__ . '/../vendor/autoload.php';

$address = isset($argv[1]) ? $argv[1] : '224.10.20.30:12345';

$factory = new Factory();
$factory = new Clue\React\Multicast\Factory();
$sender = $factory->createSender();

// do not wait for incoming messages
Expand Down
7 changes: 2 additions & 5 deletions examples/send-wait.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
* Accepts a single argument socket address (defaults to 224.10.20.30:12345)
*/

use Clue\React\Multicast\Factory;
use Clue\Hexdump\Hexdump;

require __DIR__ . '/../vendor/autoload.php';

$address = isset($argv[1]) ? $argv[1] : '224.10.20.30:12345';

$factory = new Factory();
$factory = new Clue\React\Multicast\Factory();
$sender = $factory->createSender();
$hex = new Hexdump();
$hex = new Clue\Hexdump\Hexdump();

// print a hexdump of every message received
$sender->on('message', function ($data, $remote) use ($hex) {
Expand Down
3 changes: 1 addition & 2 deletions examples/ssdp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
* UPnP simple service discovery protocol (SSDP)
*/

use Clue\React\Multicast\Factory;

require __DIR__ . '/../vendor/autoload.php';

$address = '239.255.255.250:1900';

$factory = new Factory();
$factory = new Clue\React\Multicast\Factory();
$sender = $factory->createSender();

// dump all incoming messages
Expand Down

0 comments on commit f2e98a8

Please sign in to comment.