EHS Embedded HTTP Server  1.5.0.132
RawSocketHandler Class Reference

Helper class for performing raw socket IO. More...

#include <ehs.h>

List of all members.

Public Member Functions

virtual bool OnData (EHSConnection *conn, std::string data)=0
 Handle raw data.
virtual void OnConnect (EHSConnection *conn)=0
 Handle connect event.
virtual void OnDisconnect (EHSConnection *conn)=0
 Handle disconnect event.

Detailed Description

Helper class for performing raw socket IO.

This class abstracts an interface to an external helper which which facilitates binary IO on a connection (for implementing WebSockets). In order to use raw IO, one first has to register an instance of this class using SetRawSocketHandler() and then produce a HttpResponse code 101. After sending this HttpResponse, EHS switches the corresponding connection into raw Mode, which does no further message parsing on received data, but invokes the OnData method whenever data arrives from the client.

Examples:

ehs_wsgate.cpp.


Member Function Documentation

virtual void OnConnect ( EHSConnection conn) [pure virtual]

Handle connect event.

Called by EHS, if an EHSConnection has switched into raw mode.

Parameters:
connThe EHSConnection on which the event has happened.
virtual bool OnData ( EHSConnection conn,
std::string  data 
) [pure virtual]

Handle raw data.

Called by EHS, if an EHSConnection is in raw mode.

Parameters:
connThe EHSConnection on which the data was received.
dataThe received data.
Returns:
true, if the connection should be kept open.
virtual void OnDisconnect ( EHSConnection conn) [pure virtual]

Handle disconnect event.

Called by EHS, if an EHSConnection is about to be closed.

Parameters:
connThe EHSConnection on which the event has happened.

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