vibe-project / vibe-java-server

Vibe Java Server
http://vibe-project.github.io/projects/vibe-java-server/
Apache License 2.0
12 stars 1 forks source link

Selector format #48

Open flowersinthesand opened 10 years ago

flowersinthesand commented 10 years ago

Currently id and tag are provided as selector for socket, but there is no universal selector concept. The universal selector format will make it neat and enjoyable to do 'select some sockets and do something with them' pattern. It's worth sacrificing performance within limits.

server.by(".donghwan");

In any format, we might need to modify and accept it in our own way but I don't want to reinvent the wheel and modify too much things.

URI

It deals with id and tag as path component of URI which doesn't start with '/'.

It deals with id and tag as similar one from CSS selector.

It thinks of given selector as where clause where the fixed SQL is select socket from server where ${selector} and regard socket's properties like uri, id, tags as column of table.

flowersinthesand commented 10 years ago

Expression Language like JSP EL, OGNL, SPEL would be adopted as well. It's easy to adopt since there is already implementation for similar reason but it's only for Java. It might make the protocol specific language-dependent.

flowersinthesand commented 10 years ago

A plain SAM in Java 8 would be considered also. However it is too similar to a usage of SAM as filter in all method.

server.by(s-> s.tags().contains("a") && !s.id().equals("881f80cf-4f8b-4065-8286-b42f2fb62a51"));