ZFFramework
 
Loading...
Searching...
No Matches
ZFProtocolZFWebSocket.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFProtocolZFWebSocket_h_
7#define _ZFI_ZFProtocolZFWebSocket_h_
8
9#include "ZFCore/ZFProtocol.h"
10#include "ZFNet/ZFWebSocket.h"
12
13// ============================================================
18public:
20 virtual void *open(
21 ZF_IN ZFWebSocket *owner
22 , ZF_IN const zfstring &url
25 virtual void close(
26 ZF_IN ZFWebSocket *owner
27 , ZF_IN void *nativeWebSocket
30 virtual void send(
31 ZF_IN ZFWebSocket *owner
32 , ZF_IN void *nativeWebSocket
33 , ZF_IN const void *data
34 , ZF_IN zfindex size
37 virtual void sendBin(
38 ZF_IN ZFWebSocket *owner
39 , ZF_IN void *nativeWebSocket
40 , ZF_IN const void *data
41 , ZF_IN zfindex size
43public:
45 virtual void notifyOnOpen(
46 ZF_IN ZFWebSocket *owner
47 ) {
48 owner->observerNotify(ZFWebSocket::E_OnOpen());
49 }
50
51 virtual void notifyOnClose(
52 ZF_IN ZFWebSocket *owner
53 , ZF_IN ZFResultType result
54 , ZF_IN const zfstring &reasonHint
55 ) {
56 owner->observerNotify(ZFWebSocket::E_OnClose(), zfobj<v_ZFResultType>(result), zfobj<v_zfstring>(reasonHint));
57 }
58
59 virtual void notifyOnRecv(
60 ZF_IN ZFWebSocket *owner
61 , ZF_IN const zfstring &data
62 ) {
63 owner->observerNotify(ZFWebSocket::E_OnRecv(), zfobj<v_zfstring>(data));
64 }
65
66 virtual void notifyOnRecvBin(
67 ZF_IN ZFWebSocket *owner
68 , ZF_IN const zfstring &data
69 ) {
70 owner->observerNotify(ZFWebSocket::E_OnRecvBin(), zfobj<v_zfstring>(data));
71 }
73
75#endif // #ifndef _ZFI_ZFProtocolZFWebSocket_h_
76
#define zfpurevirtual
dummy macro shows that a method is pure virtual method
Definition ZFCoreTypeDef_ClassType.h:68
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define ZFLIB_ZFNet
used to export symbols
Definition ZFNetDef.h:15
protocol definitions for ZFFramework
#define ZFPROTOCOL_INTERFACE_END(ModuleName)
for more information, please refer to ZFPROTOCOL_INTERFACE_BEGIN
Definition ZFProtocol.h:414
#define ZFPROTOCOL_INTERFACE_BEGIN(ZFLIB_, ModuleName)
declare a protocol interface for ZFFramework
Definition ZFProtocol.h:408
v_ZFResultType::ZFEnumType ZFResultType
see v_ZFResultType
Definition ZFResultType.h:23
web socket client
virtual void notifyOnRecvBin(ZFWebSocket *owner, const zfstring &data)
implementation must notify when recv data
Definition ZFProtocolZFWebSocket.h:66
virtual void sendBin(ZFWebSocket *owner, void *nativeWebSocket, const void *data, zfindex size)=0
see ZFWebSocket::close
virtual void notifyOnClose(ZFWebSocket *owner, ZFResultType result, const zfstring &reasonHint)
implementation must notify when connection closed
Definition ZFProtocolZFWebSocket.h:51
virtual void close(ZFWebSocket *owner, void *nativeWebSocket)=0
see ZFWebSocket::close
virtual void * open(ZFWebSocket *owner, const zfstring &url)=0
see ZFWebSocket::open
virtual void send(ZFWebSocket *owner, void *nativeWebSocket, const void *data, zfindex size)=0
see ZFWebSocket::close
virtual void notifyOnOpen(ZFWebSocket *owner)
implementation must notify when connection opened
Definition ZFProtocolZFWebSocket.h:45
virtual void notifyOnRecv(ZFWebSocket *owner, const zfstring &data)
implementation must notify when recv data
Definition ZFProtocolZFWebSocket.h:59
web socket client
Definition ZFWebSocket.h:17
static zfidentity E_OnOpen(void)
see ZFObject::observerNotify
static zfidentity E_OnRecvBin(void)
see ZFObject::observerNotify
static zfidentity E_OnRecv(void)
see ZFObject::observerNotify
static zfidentity E_OnClose(void)
see ZFObject::observerNotify
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:157