# Passenger::MessageServer::Handler Class Reference

An abstract message handler class. More...

`#include <MessageServer.h>`

Inherited by ExitHandler, ExitHandler, and TimerUpdateHandler.

List of all members.

## Public Member Functions
virtual ClientContextPtr | newClient (CommonClientContext &context)
| Called when a new client has connected to the MessageServer.
virtual void | clientDisconnected (MessageServer::CommonClientContext &context, MessageServer::ClientContextPtr &handlerSpecificContext)
| Called when a client has disconnected from the MessageServer.
virtual bool | processMessage (CommonClientContext &commonContext, ClientContextPtr &handlerSpecificContext, const vector< string > &args)=0
| Called then a client has sent a request message.

## Detailed Description

An abstract message handler class.

The methods defined in this class are allowed to throw arbitrary exceptions. Such exceptions are caught and logged, after which the connection to the client is closed.

## Member Function Documentation

virtual void Passenger::MessageServer::Handler::clientDisconnected | ( | MessageServer::CommonClientContext & | context,
|  | MessageServer::ClientContextPtr & | handlerSpecificContext |
| ) |  |  | `[inline, virtual]`

Called when a client has disconnected from the MessageServer.

The default implementation does nothing.

This method is called even if processMessage() throws an exception. It is however not called if newClient() throws an exception.

Parameters:

  | commonContext | Contains common client-specific information.
  | handlerSpecificContext | The client context object as was returned earlier by newClient().

virtual ClientContextPtr Passenger::MessageServer::Handler::newClient | ( | CommonClientContext & | context | ) | `[inline, virtual]`

Called when a new client has connected to the MessageServer.

This method is called after the client has authenticated itself.

Parameters:

  | context | Contains common client-specific information.

Returns:
  A client context object for storing handler-specific client information, or null. The default implementation returns null.

virtual bool Passenger::MessageServer::Handler::processMessage | ( | CommonClientContext & | commonContext,
|  | ClientContextPtr & | handlerSpecificContext,
|  | const vector< string > & | args |
| ) |  |  | `[pure virtual]`

Called then a client has sent a request message.

This method is called after newClient() is called.

Parameters:

  | commonContext | Contains common client-specific information.
  | handlerSpecificContext | The client context object as was returned earlier by newClient().
  | args | The request message's contents.

Returns:
  Whether this handler has processed the message. Return false if the message is unrecognized.

The documentation for this class was generated from the following file:

- MessageServer.h