The following example uses message filtering to send messages to members of a team in a chat application:
To join a team, users set the client attribute "team" to either "red" or "blue". To send a message to the current user's team only, the application passes an AttributeFilter to the Room object's sendMessage() method.
Here is the code for the preceding example. Click the "+" button to edit it live on JSFiddle.