At runtime there are no use cases where one would like to re-create the reactor. only multi instance scenario is unit tests, but those don't need to be covered in the public api.
- Added `Amp\coroutine()` function
- `YieldCommands` "enum" constant class removed -- yield keys now live in
the reactor class
- New optional `"coroutine"` yield key for self-documenting generator
yields.
- New optional `"async"` yield key for self-documenting promise yields.
- New `"return"` yield key for specifying the return value of a resolved
Generator coroutine. If not specified a resolved coroutine result is
equal to null.
- The final value yielded by a resolved `Generator` is *no longer* used
as its "return" value. Instead, generators must manually use the new
`"return"` yield key specifically to designate the value that should
be used to resolve the promise associated with generator resolution.
- `GeneratorResolver` trait renamed to `CoroutineResolver` and is now an
abstract class extended by the various `Reactor` implementations.
- Implicit "all" array combinator resolution is now removed. Use the
explicit form instead:
```php
function() {
list($a, $b, $c) = (yield 'all' => [$promise1, $promise2, $promise3]);
};
```
If there are immediates generated in immediates, they have to wait until next tick - which may only be triggered in far future or never, depending on if there are other read/writeWatchers or timers So, now just do a single event run without blocking if there are new immediates generated during immediates execution
Using UvReactor or LibeventReactor directly (instead of Amp\getReactor)
doesn't check if php-uv/libevent is loaded and dies with a 'Call to undefined
function' message.
echo server example (run in terminal):
- start the service
php 007_broadcast_server.php
- Connect to 127.0.0.1 at port 1337 from various terminals;
nc 127.0.0.1 1337
- Type in anything and press ENTER; Reactor will asyncronously read
from client and broadcast to others.