tyrus icon indicating copy to clipboard operation
tyrus copied to clipboard

TyrusSession.broadcast should allow the client to provide a predicate

Open glassfishrobot opened this issue 11 years ago • 3 comments

I feel that TyrusSession.broadcast should take a Predicate filter so that messages can easily be sent to sub sections of the connected clients.

So it should be possible to do something like this:

((TyrusSession)session).broadcast(message, s -> s.getUserProperties().conains("NAME"));

Ideally the interface should be serialisable so that the same expression could be used across the cluster as per bug #455, you do need to be a little bit careful in this case as this blog shows:

http://kingsfleet.blogspot.co.uk/2013/12/lambda-will-it-serialize.html

Obviously the code will be written in a form that will work with JDK6 but can be more pleasant to use with JDK 8.

Affected Versions

[1.3.1]

glassfishrobot avatar Dec 06 '13 12:12 glassfishrobot