Skip to content

New methods except, isRoomEmpty and primus.rooms

Compare
Choose a tag to compare
@cayasso cayasso released this 04 Dec 19:52
· 129 commits to master since this release

except

Broadcast messages to clients in a room except to those specified.

spark.room('room').except('1386018854525$0 1386018854526$1').write('hi');

or pass an array:

var except = ['1386018854525$0', '1386018854526$1'];
spark.room('room').except(except).write('hi');

This method works the same on the way on the spark object.

isRoomEmpty

This release also adds isRoomEmpty for checking to see if a room is empty:

On the server:

// on the server
primus.isRoomEpty('sport');
primus.in('sport').isRoomEpty();

// on the spark
spark.isRoomEpty('sport');
spark.in('sport').isRoomEpty();

primus.rooms

Now you can get all active rooms on the server or still get all rooms a spark is in with the same method, initially this method was only supported by the spark object.

primus.rooms();
primus.rooms(spark, fn);

There were also some bug fixes, test refactoring and documentation improvements, thanks to all who helped reporting and resolving issues @lpinca, @davedoesdev, @Dshankar.

Changelog

  • 06649cf [test] Some minor changes
  • 8efe49c [minor] primus.isRoomEmpty change
  • a29d8f9 [minor] clients method refactoring
  • 30d5899 [fix] Small correction
  • 7c11809 [fix] Small fix
  • f8db25e [doc] Adding primus.rooms documentation
  • c4d4d6f [feature] Adding primus.rooms method
  • b9525b9 Merge pull request #19 from Dshankar/master
  • 317b636 added getRooms
  • 2ad126f [doc] Documenting except on the server
  • 5f2b996 [feature] Adding except method to server
  • 82c07be [doc] Documenting isRoomEmpty and except
  • 96dfb3a [feature] Adding isRoomEmpty method to server
  • 9605989 [fix] Small fix
  • 838d23c [feature] Adding isRoomEmpty method
  • 502e391 [feature] Adding except method for brodcasting
  • 99a846f [test] Adding not allowed ack test
  • fc7f0aa [fix] Do not allow broadcasting messages with ack
  • a1e929e Merge pull request #17 from lpinca/test/chaining-support
  • 52a6bfd [test] Adding test for chaining support when sending to a room from server
  • ef6129b Merge pull request #16 from lpinca/tests
  • 45277bb [test] Removing a redundant test
  • 2176c8a [fix] Fixing some tests
  • 8e875b4 [doc] Adding primus-resource to plugins list