Skip to content

.empty, updates to primus .join .leave

Latest
Compare
Choose a tag to compare
@cayasso cayasso released this 08 Jan 23:49
· 117 commits to master since this release

.join(sparks, room) .leave(sparks, room)

This release adds some additional features to the already known join/leave server methods, you can now pass either a spark instance(as before), id or an array of sparks (instances or ids or a mix) to primus.join and primus.leave methods.

primus.join('1389028863093$0', 'news', fn);
primus.join([spark1, spark2, spark3], 'news', fn);
primus.join([spark1, spark2, spark3], 'news sport', fn);
primus.join(['1389028863093$0', '1389028863093$1', spark3], 'news sport', fn);

The same apply for leave:

primus.leave('1389028863093$0', 'news', fn);
primus.leave([spark1, spark2, spark3], 'news', fn);
primus.leave([spark1, spark2, spark3], 'news sport', fn);
primus.leave(['1389028863093$0', '1389028863093$1', spark3], 'news sport', fn);

empty

Remove all clients from a room or multiple rooms.

primus.room('sport').empty();
// or
primus.empty('sport');

or multiple rooms at the same time:

primus.room('news sport').empty();
// or
primus.empty('news sport');

Infinite recursion bug solved

This release also fixes an important bug reported by @ruimarinho #22

Check bellow for complete change log and thanks to all contributors.

Changelog

  • 8d7264 [doc] Documenting new primus join/leave features
  • e02e122 [feature] Allowing passing array of sparks to primus.join and primus.leave
  • 21e154e [feature] Adding an empty method to server #21
  • d437dc0 [minor] Refactoring and cleaning up methods
  • 37af1be [bug] Disabling broadcast flag on non brodcast methods #22
  • 4c8e1d2 [minor] Fixing typo
  • 458be39 [minor] Cleaning up examples
  • 4c24bcf Merge branch 'master' of https://github.com/cayasso/primus-rooms
  • b4ed030 [fix] Stop brodcasting from a destroyed spark
  • 6991b3e Merge pull request #20 from Dshankar/master
  • 87923fa minor fix on README for leaveallrooms event