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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angelia.io",
3
- "version": "4.0.86",
3
+ "version": "4.0.87",
4
4
  "description": "WebSockets Server and Client API for node.js and the browser, with rooms support.",
5
5
  "author": "@titoBouzout @boredofnames",
6
6
  "license": "GPL",
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
@@ -66,7 +66,7 @@ export default new (class Server extends Emitter {
66
66
  * timeout?: number
67
67
  * }} [options]
68
68
  */
69
- listen(options) {
69
+ listen(options = {}) {
70
70
  this.hostname = options.hostname || this.hostname
71
71
  this.port =
72
72
  +options.port > 0 && +options.port <= 65535