angelia.io 4.0.86 → 4.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/readme.md +5 -0
- package/server/Server.js +1 -1
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -211,6 +211,10 @@ As in `socket.on('connect', () => console.log('connect happened!'))`
|
|
|
211
211
|
are created when the `id` of the room doesn't exists, and deleted
|
|
212
212
|
when there are no sockets in the room and the room doesn't have the
|
|
213
213
|
flag `persistent`
|
|
214
|
+
4. a socket will leave automatically all rooms on disconnection
|
|
215
|
+
5. `socket.rooms` is a set with all the rooms the socket joined
|
|
216
|
+
6. a room list is an iterable that returns all of the sockets in the
|
|
217
|
+
room
|
|
214
218
|
|
|
215
219
|
```js
|
|
216
220
|
import { Room, Rooms } from 'angelia.io/server'
|
|
@@ -243,6 +247,7 @@ class Connection {
|
|
|
243
247
|
connect(socket) {
|
|
244
248
|
game.join(socket, 'room id here')
|
|
245
249
|
socket.room.id === 'room id here'
|
|
250
|
+
console.log(socket.rooms)
|
|
246
251
|
game.leave(socket, 'room id here')
|
|
247
252
|
|
|
248
253
|
game.join(socket, 'a different room')
|
package/server/Server.js
CHANGED