Skip to content

Commit a7557c7

Browse files
Added example usage to readme for isRoute and hasRoute methods
1 parent d5219fa commit a7557c7

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

readme.MD

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,39 @@ socket.onmessage = function (ev) {
322322

323323
```
324324

325+
**is Route and hasRoute methods**
326+
327+
328+
1. **hasRoute:**
329+
Is there any client connecting via /chat route?.
330+
331+
2. **isRoute:**
332+
Is the current client connected via the /chat route?.
333+
334+
335+
336+
```php
337+
class Handler extends AbstractSocketClientHandler
338+
{
339+
340+
/**
341+
*/
342+
#[Override]
343+
public function run(): void
344+
{
345+
$this->hasRoute('/chat');//Is there any client connecting via /chat route?
346+
$this->isRoute('/chat'); //Is the current client connected via the /chat route?
347+
}
348+
}
349+
350+
351+
$socketServer = new SocketServer(Handler::class);
352+
$socketServer->serve(
353+
'0.0.0.0',
354+
8080
355+
);
356+
```
357+
325358
### The host address of the client
326359
Let's disconnect the socket connection of an ip address
327360
<br/>

0 commit comments

Comments
 (0)