Class HelpNowMessageHandler
java.lang.Object
|
+--com.xfactorstudio.ahawasi.GenericMessageHandler
|
+--HelpNowMessageHandler
- All Implemented Interfaces:
- MessageHandler
- public class HelpNowMessageHandler
- extends GenericMessageHandler
This message handler provides all the specifics of message handling
for a specified service.
It contains a number of event handlers, onConnect, onDisconnect, and onMessage.
As expected, onConnect will fire when a user connects to the service, onMessage
will fire after each message arrives for this user and onDisconnect will fire,
that's right, you guessed it, when a user disconnects.
There are two object (request and response) that are instanciated for you at
runtime. They are available from all methods automatically and provide methods
for sending messages to all or only specific users as well as setting and
reading server, application and session variables.
See the javadocs for specific information on what methods are
currently available.
Method Summary |
void |
onConnect()
The onConnect method is called
when this users first connects
to the server. |
void |
onDisconnect()
The onDisconnect method is called
when this users connection is broken
or closed. |
void |
onMessage(java.lang.String message)
The onMessage method is called
whenever a message is recieved. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HelpNowMessageHandler
public HelpNowMessageHandler()
onConnect
public void onConnect()
- The onConnect method is called
when this users first connects
to the server.
This is not currently utilized in the
HelpNow API.
- Overrides:
onConnect
in class GenericMessageHandler
onDisconnect
public void onDisconnect()
- The onDisconnect method is called
when this users connection is broken
or closed.
Here we are using it to send a message
about the disconnect to the other user.
- Overrides:
onDisconnect
in class GenericMessageHandler
onMessage
public void onMessage(java.lang.String message)
- The onMessage method is called
whenever a message is recieved.
Messages arrive as a string and can be
processed in any way you see fit.
The NanoXML package was added to the
Ahawasi package to provide a simple
and lightweight XML parser.
- Overrides:
onMessage
in class GenericMessageHandler