|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elkoserver.foundation.actor.BasicProtocolHandler
public abstract class BasicProtocolHandler
Utility message handler implementation base class that supports a basic JSON protocol for connection housekeeping. The supported protocol is common to many actors in Elko. It includes the messages 'auth', 'debug', 'disconnect', 'ping', and 'pong'. This base class provides default implementations for these messages that should be satisfactory in nearly all circumstances.
| Constructor Summary | |
|---|---|
protected |
BasicProtocolHandler()
Constructor. |
| Method Summary | |
|---|---|
void |
auth(BasicProtocolActor from,
AuthDesc auth,
OptString label)
JSON method for the 'auth' message. |
void |
debug(BasicProtocolActor from,
String msg)
JSON method for the 'debug' message. |
void |
disconnect(BasicProtocolActor from)
JSON method for the 'disconnect' message. |
void |
ping(BasicProtocolActor from,
OptString tag)
JSON method for the 'ping' message. |
void |
pong(BasicProtocolActor from,
OptString tag)
JSON method for the 'pong' message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.elkoserver.json.Referenceable |
|---|
ref |
| Constructor Detail |
|---|
protected BasicProtocolHandler()
| Method Detail |
|---|
@JSONMethod(value={"?auth","label"})
public void auth(BasicProtocolActor from,
AuthDesc auth,
OptString label)
recv: { to:REF, op:"auth", auth:AUTHDESC,
label:optSTR }
send: no reply is sent
from - The connection over which the message was received.auth - Authorization information being offered.label - Descriptive label for this connection, for logging.
@JSONMethod(value="msg")
public void debug(BasicProtocolActor from,
String msg)
recv: { to:ignored, op:"debug",
msg:STR }
send: no reply is sent
from - The connection over which the message was received.msg - Text to write to the server log;@JSONMethod public void disconnect(BasicProtocolActor from)
recv: { to:ignored, op:"disconnect" }
send: there is no reply, since the connection is closed
from - The connection over which the message was received.
@JSONMethod(value="tag")
public void ping(BasicProtocolActor from,
OptString tag)
recv: { to:REF, op:"ping",
tag:optSTR }
send: { to:asReceived, op:"pong",
tag:asReceived }
from - The connection over which the message was received.tag - Optional tag string; if provided, it will be included in the
reply.
@JSONMethod(value="tag")
public void pong(BasicProtocolActor from,
OptString tag)
recv: { to:ignored, op:"pong",
tag:optSTR }
send: no reply is sent
from - The connection over which the message was received.tag - Optional tag string, which should echo the tag (if any) from
the 'ping' message that caused this 'pong' to be sent.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||