Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Commit d9d9747

Browse files
authored
Update README.md
1 parent d861434 commit d9d9747

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Now, you can run the following command to start the **swoole_http_server**.
164164
$ php artisan swoole:http start
165165
```
166166

167-
## Get related instances in your project
167+
## Get Related Instances in Laravel
168168

169169
* Swoole\Http\Server: By `SwooleTW\Http\Server\Facades\Server` or `app('swoole.server')`
170170

@@ -205,6 +205,28 @@ Websocket::join('some room');
205205
Websocket::leave('some room');
206206
```
207207

208+
* SwooleTW\Http\Websocket\Rooms\RoomContract: By `SwooleTW\Http\Websocket\Facades\Room` or `app('swoole.room')`
209+
210+
```php
211+
// get all fds in a 'game' room
212+
Room::getClients('game');
213+
214+
// get all rooms of fd 1
215+
Room::getRooms(1);
216+
217+
// add fd 1 to a 'game' room
218+
Room::add(1, 'room');
219+
220+
// add fd 1 to 'game' and 'test' rooms
221+
Room::addAll(1, ['game', 'test']);
222+
223+
// delete fd 1 from a 'game' room
224+
Room::delete(1, 'room');
225+
226+
// delete fd 1 from 'game' and 'test' rooms
227+
Room::deleteAll(1, ['game', 'test']);
228+
```
229+
208230
## Nginx Configuration
209231

210232
> The support of swoole_http_server for Http is not complete. So, you should configure the domains via nginx proxy in your production environment.

0 commit comments

Comments
 (0)