1- Classes: [ Client] ( Classes/ Client.md) • Server
1+ Classes: [ Client] ( Client.md ) • Server
22
33# Server class
44
@@ -65,22 +65,22 @@ public function __construct(array $options = [])
6565###### ` options `
6666
6767An optional array of parameters.
68- | Name | Type | | Default | Description |
69- | --- | --- | --- | --- [
70- | ` filter ` | ` array ` | ` ['text', 'binary'] ` | Array of opcodes to return on receive and listen functions
71- | ` fragment_size ` | ` int ` | ` 4096 ` | Maximum payload size
72- | ` logger ` | ` Psr\Log\LoggerInterface ` | ` Psr\Log\NullLogger ` |A [ PSR-3] ( https://www.php-fig.org/psr/psr-3/ ) compatible logger
73- | ` port ` | ` int ` | ` 8000 ` | The server port to listen to
74- | ` return_obj ` | ` bool ` | ` false ` | Return a [ Message] ( Classes/ Message.md) instance on receive function
75- | ` timeout ` | ` int ` | ` 5 ` | Time out in seconds
68+ Name | Type | Default | Description
69+ --- | --- | --- | ---
70+ filter` | array | [ 'text', 'binary'] | Array of opcodes to return on receive and listen functions
71+ fragment_size | int | 4096 | Maximum payload size
72+ logger | Psr\Log\LoggerInterface | Psr\Log\NullLogger |A [ PSR-3] ( https://www.php-fig.org/psr/psr-3/ ) compatible logger
73+ port | int | 8000 | The server port to listen to
74+ return_obj | bool | false | Return a [ Message] ( Message.md ) instance on receive function
75+ timeout | int | 5 | Time out in seconds
7676
7777#### Return Values
7878
7979Returns a new WebSocket\Server instance.
8080
8181#### Errors/Exceptions
8282
83- Emits [ ConnectionException] ( Classes/ ConnectionException.md) on failure.
83+ Emits [ ConnectionException] ( ConnectionException.md ) on failure.
8484
8585#### Examples
8686
@@ -129,8 +129,8 @@ public function listen(Closure $callback) : mixed
129129A callback function that is triggered whenever the server receives a message matching the filter.
130130
131131The callback takes two parameters;
132- * The [ Message] ( Classes/ Message/Message.md) that has been received
133- * The [ Connection] ( Classes/ Connection.md) the server has receievd on, can be ` null ` if connection is closed
132+ * The [ Message] ( Message/Message.md ) that has been received
133+ * The [ Connection] ( Connection.md ) the server has receievd on, can be ` null ` if connection is closed
134134
135135If callback function returns non-null value, the listener will halt and return that value.
136136Otherwise it will continue listening and propagating messages.
@@ -141,7 +141,7 @@ Returns any non-null value returned by callback function.
141141
142142#### Errors/Exceptions
143143
144- Emits [ ConnectionException] ( Classes/ ConnectionException.md) on failure.
144+ Emits [ ConnectionException] ( ConnectionException.md ) on failure.
145145
146146#### Examples
147147
@@ -173,7 +173,7 @@ Halt listener and return a value to calling code.
173173``` php
174174<?php
175175
176- $server = new WebSocket\Server(['filter' => ['text', 'binary', 'ping', 'pong', 'close']] );
176+ $server = new WebSocket\Server();
177177$content = $server->listen(function ($message, $connection) {
178178 return $message->getContent();
179179});
0 commit comments