HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_WebSocketHandler Class Reference

#include <NET_HTTPTaskHandler.h>

+ Inheritance diagram for NET_WebSocketHandler:

Classes

class  Router
 

Public Member Functions

 NET_WebSocketHandler (NET_WebEndpoint &ep)
 
int64 calcElapsedTime (time_t) const override
 
const char * className () const override
 
- Public Member Functions inherited from NET_WebTaskHandler
 NET_WebTaskHandler (NET_WebEndpoint &ep)
 
virtual ~NET_WebTaskHandler ()=default
 
const NET_TimeprocessStartTime () const
 
void setHasWork (bool has_work)
 
SYS_FORCE_INLINE bool isFinished () const
 

Protected Member Functions

void onProcess () override
 
virtual void onMessage (const UT_StringRef &data, bool is_binary)
 
virtual void onPing (const UT_StringRef &data)
 
virtual void onPong (const UT_StringRef &data)
 
void write (const UT_StringRef &message)
 

Additional Inherited Members

- Public Types inherited from NET_WebTaskHandler
using Callback = UT_Functor< void >
 
- Public Attributes inherited from NET_WebTaskHandler
NET_WebEndpointmyEP
 
Callback myOnOpen
 
Callback myOnClose
 
bool myHasMoreWork
 
NET_Time myProcessTime
 

Detailed Description

This is the base web socket handler. This handler will handle http and web socket connections. Please keep in mind that once upgraded to a websocket the handler will stick to being a websocket for its entire lifetime.

NOTE: This assumes its used on the server side. Which means that writing does NOT add a mask which in some implementations causes an error (i.e. pythong). Do not add a mask when writing without being certain who initiated the connection.

Definition at line 56 of file NET_HTTPTaskHandler.h.

Constructor & Destructor Documentation

NET_WebSocketHandler::NET_WebSocketHandler ( NET_WebEndpoint ep)

Member Function Documentation

int64 NET_WebSocketHandler::calcElapsedTime ( time_t  ) const
inlineoverridevirtual

Reimplemented from NET_WebTaskHandler.

Definition at line 61 of file NET_HTTPTaskHandler.h.

const char* NET_WebSocketHandler::className ( ) const
inlineoverridevirtual

Implements NET_WebTaskHandler.

Definition at line 66 of file NET_HTTPTaskHandler.h.

virtual void NET_WebSocketHandler::onMessage ( const UT_StringRef data,
bool  is_binary 
)
inlineprotectedvirtual

Reimplemented in NET_WebSocketAPIHandler.

Definition at line 104 of file NET_HTTPTaskHandler.h.

virtual void NET_WebSocketHandler::onPing ( const UT_StringRef data)
protectedvirtual
virtual void NET_WebSocketHandler::onPong ( const UT_StringRef data)
inlineprotectedvirtual

Definition at line 108 of file NET_HTTPTaskHandler.h.

void NET_WebSocketHandler::onProcess ( )
overrideprotectedvirtual

Reimplemented from NET_WebTaskHandler.

void NET_WebSocketHandler::write ( const UT_StringRef message)
protected

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