@@ -10,9 +10,8 @@ It does not include convenience operations such as listeners and implicit error
10
10
11
11
## Documentation
12
12
13
- - [ Client overwiew] ( docs/Client.md )
14
- - [ Server overview] ( docs/Server.md )
15
- - [ Classes] ( docs/Classes/Classes.md )
13
+ - [ Client] ( docs/Client.md )
14
+ - [ Server] ( docs/Server.md )
16
15
- [ Examples] ( docs/Examples.md )
17
16
- [ Changelog] ( docs/Changelog.md )
18
17
- [ Contributing] ( docs/Contributing.md )
@@ -43,17 +42,18 @@ $client->close();
43
42
44
43
## Server
45
44
46
- The library contains a websocket [ server] ( docs/Server.md ) .
45
+ The library contains a rudimentary single stream/single thread [ server] ( docs/Server.md ) .
47
46
It internally supports Upgrade handshake and implicit close and ping/pong operations.
48
- Preferred operation is using the listener function, but optional operations exist.
47
+
48
+ Note that it does ** not** support threading or automatic association ot continuous client requests.
49
+ If you require this kind of server behavior, you need to build it on top of provided server implementation.
49
50
50
51
``` php
51
52
$server = new WebSocket\Server();
52
- $server->listen(function ($message, $connection = null) {
53
- echo "Got {$message->getContent()}\n";
54
- if (!$connection) return; // Current connection is closed
55
- $connection->text('Sending message to client');
56
- });
53
+ $server->accept();
54
+ $message = $server->receive();
55
+ $server->text($message);
56
+ $server->close();
57
57
```
58
58
59
59
### License and Contributors
0 commit comments