public interface Server
A Server
instance provides Socket
processing HTTP request and
WebSocket under the specific URI pattern and manages their life cycles. The
Server
API is used to accept socket and to find socket by id and tag.
If you are using dependency injection support, make a Server
as
component and inject it wherever you need to handle socket.
The Server
is a wes application so can be installed on any platform
like Servlet wes supports. For that reason, Server
doesn't concern
I/O details and I/O details should be configured in the platform following
its policy.
Server may be accessed by multiple threads.
Modifier and Type | Method and Description |
---|---|
Sentence |
all()
Returns a sentence that all of the socket in this server or all of the
server if it's in a clustered environment have to follow.
|
Server |
all(Action<Socket> action)
Executes the given action retrieving all of the socket in this server or
all of the server if it's in a clustered environment .
|
Sentence |
byId(String id)
Returns a sentence that the socket of the given id in this server or all
of the server if it's in a clustered environment have to follow.
|
Server |
byId(String id,
Action<Socket> action)
Executes the given action retrieving the socket of the given id in this
server or all of the server if it's in a clustered environment.
|
Sentence |
byTag(String... names)
Returns a sentence that the socket tagged with all of the given names in
this server or all of the server if it's in a clustered environment have
to follow.
|
Server |
byTag(String[] names,
Action<Socket> action)
Executes the given action retrieving the socket tagged with all of the
given names in this server or all of the server if it's in a clustered
environment.
|
Server |
byTag(String name,
Action<Socket> action)
Executes the given action retrieving the socket tagged with the given
name in this server or all of the server if it's in a clustered
environment.
|
Action<ServerHttpExchange> |
httpAction()
ServerHttpExchange action to install in wes
|
Server |
socketAction(Action<Socket> action)
Registers an action to be called when the socket has been opened in this
server regardless of clustering.
|
Action<ServerWebSocket> |
websocketAction()
ServerWebSocket action to install in wes
|
Sentence all()
Server all(Action<Socket> action)
Sentence byId(String id)
Server byId(String id, Action<Socket> action)
Sentence byTag(String... names)
Server byTag(String name, Action<Socket> action)
Server byTag(String[] names, Action<Socket> action)
Server socketAction(Action<Socket> action)
Action<ServerHttpExchange> httpAction()
Action<ServerWebSocket> websocketAction()
Copyright 2012-2014, Donghwan Kim