|
1 | 1 | # Changelog |
2 | 2 |
|
| 3 | +## 0.5.0 (2017-02-14) |
| 4 | + |
| 5 | +* Feature / BC break: Replace `listen()` call with URIs passed to constructor |
| 6 | + and reject listening on hostnames with `InvalidArgumentException` |
| 7 | + and replace `ConnectionException` with `RuntimeException` for consistency |
| 8 | + (#61, #66 and #72 by @clue) |
| 9 | + |
| 10 | + ```php |
| 11 | + // old |
| 12 | + $server = new Server($loop); |
| 13 | + $server->listen(8080); |
| 14 | + |
| 15 | + // new |
| 16 | + $server = new Server(8080, $loop); |
| 17 | + ``` |
| 18 | + |
| 19 | + Similarly, you can now pass a full listening URI to the constructor to change |
| 20 | + the listening host: |
| 21 | + |
| 22 | + ```php |
| 23 | + // old |
| 24 | + $server = new Server($loop); |
| 25 | + $server->listen(8080, '127.0.0.1'); |
| 26 | + |
| 27 | + // new |
| 28 | + $server = new Server('127.0.0.1:8080', $loop); |
| 29 | + ``` |
| 30 | + |
| 31 | + Trying to start listening on (DNS) host names will now throw an |
| 32 | + `InvalidArgumentException`, use IP addresses instead: |
| 33 | + |
| 34 | + ```php |
| 35 | + // old |
| 36 | + $server = new Server($loop); |
| 37 | + $server->listen(8080, 'localhost'); |
| 38 | + |
| 39 | + // new |
| 40 | + $server = new Server('127.0.0.1:8080', $loop); |
| 41 | + ``` |
| 42 | + |
| 43 | + If trying to listen fails (such as if port is already in use or port below |
| 44 | + 1024 may require root access etc.), it will now throw a `RuntimeException`, |
| 45 | + the `ConnectionException` class has been removed: |
| 46 | + |
| 47 | + ```php |
| 48 | + // old: throws React\Socket\ConnectionException |
| 49 | + $server = new Server($loop); |
| 50 | + $server->listen(80); |
| 51 | + |
| 52 | + // new: throws RuntimeException |
| 53 | + $server = new Server(80, $loop); |
| 54 | + ``` |
| 55 | + |
| 56 | +* Feature / BC break: Rename `shutdown()` to `close()` for consistency throughout React |
| 57 | + (#62 by @clue) |
| 58 | + |
| 59 | + ```php |
| 60 | + // old |
| 61 | + $server->shutdown(); |
| 62 | + |
| 63 | + // new |
| 64 | + $server->close(); |
| 65 | + ``` |
| 66 | + |
| 67 | +* Feature / BC break: Replace `getPort()` with `getAddress()` |
| 68 | + (#67 by @clue) |
| 69 | + |
| 70 | + ```php |
| 71 | + // old |
| 72 | + echo $server->getPort(); // 8080 |
| 73 | + |
| 74 | + // new |
| 75 | + echo $server->getAddress(); // 127.0.0.1:8080 |
| 76 | + ``` |
| 77 | + |
| 78 | +* Feature / BC break: `getRemoteAddress()` returns full address instead of only IP |
| 79 | + (#65 by @clue) |
| 80 | + |
| 81 | + ```php |
| 82 | + // old |
| 83 | + echo $connection->getRemoteAddress(); // 192.168.0.1 |
| 84 | + |
| 85 | + // new |
| 86 | + echo $connection->getRemoteAddress(); // 192.168.0.1:51743 |
| 87 | + ``` |
| 88 | + |
| 89 | +* Feature / BC break: Add `getLocalAddress()` method |
| 90 | + (#68 by @clue) |
| 91 | + |
| 92 | + ```php |
| 93 | + echo $connection->getLocalAddress(); // 127.0.0.1:8080 |
| 94 | + ``` |
| 95 | + |
| 96 | +* BC break: The `Server` and `SecureServer` class are now marked `final` |
| 97 | + and you can no longer `extend` them |
| 98 | + (which was never documented or recommended anyway). |
| 99 | + Public properties and event handlers are now internal only. |
| 100 | + Please use composition instead of extension. |
| 101 | + (#71, #70 and #69 by @clue) |
| 102 | + |
3 | 103 | ## 0.4.6 (2017-01-26) |
4 | 104 |
|
5 | 105 | * Feature: Support socket context options passed to `Server` |
|
0 commit comments