Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kWebSocket.h
Go to the documentation of this file.
1
10 #ifndef K_API_WEBSOCKET_H
11 #define K_API_WEBSOCKET_H
12
13 #include <kApi/kApiDef.h>
14 #include <kApi/Io/kNetwork.h>
15
22 typedef k32s kWebSocketDataType;
23
25 #define kWEB_SOCKET_DATA_TYPE_NULL (0x0)
26 #define kWEB_SOCKET_DATA_TYPE_UTF8 (0x1)
27 #define kWEB_SOCKET_DATA_TYPE_BINARY (0x2)
28
30 #include <kApi/Io/kWebSocket.x.h>
31
121 //typedef kStream kWebSocket; --forward-declared in kApiDef.x.h
122
131 kFx(kStatus) kWebSocket_Construct(kWebSocket* webSocket, kAlloc allocator);
132
149 kFx(kStatus) kWebSocket_SetWriteBuffers(kWebSocket webSocket, kSSize socketSize, kSSize clientSize);
150
164 kFx(kStatus) kWebSocket_SetReadBuffers(kWebSocket webSocket, kSSize socketSize, kSSize clientSize);
165
178 kFx(kStatus) kWebSocket_Connect(kWebSocket webSocket, kIpAddress address, k32u port, const kChar* host, const kChar* uri, k64u timeout);
179
191 kFx(kStatus) kWebSocket_Close(kWebSocket webSocket);
192
209 kFx(kStatus) kWebSocket_SetSendType(kWebSocket webSocket, kWebSocketDataType type);
210
231 kFx(kStatus) kWebSocket_Send(kWebSocket webSocket);
232
253 kFx(kStatus) kWebSocket_Receive(kWebSocket webSocket, k64u timeout);
254
269 kFx(kStatus) kWebSocket_WriteMessage(kWebSocket webSocket, const void* buffer, kSize size);
270
289 kFx(kStatus) kWebSocket_ReadMessage(kWebSocket webSocket, kMemory memory, k64u timeout);
290
299 kFx(kStatus) kWebSocket_Cancel(kWebSocket webSocket);
300
311 kFx(kStatus) kWebSocket_SendPing(kWebSocket webSocket);
312
320 kFx(k64u) kWebSocket_LastPong(kWebSocket webSocket);
321
329 kFx(kWebSocketDataType) kWebSocket_SendType(kWebSocket webSocket);
330
338 kFx(kWebSocketDataType) kWebSocket_ReceiveType(kWebSocket webSocket);
339
340 #endif
kWebSocket::kWebSocket_Cancel
kStatus kWebSocket_Cancel(kWebSocket webSocket)
Cancels any pending I/O operations.
k32u
Represents a 32-bit unsigned integer.
kWebSocket::kWebSocket_LastPong
k64u kWebSocket_LastPong(kWebSocket webSocket)
Reports the time at which the most recent pong message arrived.
kMemory
Represents an in-memory stream.
kWebSocket::kWebSocket_SetWriteBuffers
kStatus kWebSocket_SetWriteBuffers(kWebSocket webSocket, kSSize socketSize, kSSize clientSize)
Sets the size of write buffers.
k64u
Represents a 64-bit unsigned integer.
kWebSocket
Represents a WebSocket.
kWebSocket::kWebSocket_SendType
kWebSocketDataType kWebSocket_SendType(kWebSocket webSocket)
Reports the message data type currently used for sending.
kWebSocket::kWebSocket_WriteMessage
kStatus kWebSocket_WriteMessage(kWebSocket webSocket, const void *buffer, kSize size)
Writes a complete WebSocket message.
kWebSocketDataType
Represents Websocket message content type.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kWebSocket::kWebSocket_Send
kStatus kWebSocket_Send(kWebSocket webSocket)
Sends any buffered data and ends the current message.
kWebSocket::kWebSocket_ReadMessage
kStatus kWebSocket_ReadMessage(kWebSocket webSocket, kMemory memory, k64u timeout)
Blocks until a whole message has been read (or until a timeout occurs).
kIpAddress
Represents an IP address.
Definition: kNetwork.h:37
kChar
Represents a single unit (byte) in a UTF-8 character.
kWebSocket::kWebSocket_SetSendType
kStatus kWebSocket_SetSendType(kWebSocket webSocket, kWebSocketDataType type)
Sets the data transfer type used for send operations.
kSSize
Represents a signed integer that can store a pointer address.
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kNetwork.h
IP networking definitions.
kStatus
Represents an error code.
kWebSocket::kWebSocket_ReceiveType
kWebSocketDataType kWebSocket_ReceiveType(kWebSocket webSocket)
Reports the data type of the most recently received data message.
kWebSocket::kWebSocket_Construct
kStatus kWebSocket_Construct(kWebSocket *webSocket, kAlloc allocator)
Constructs a WebSocket that can be used to connect to a server.
kWebSocket::kWebSocket_SendPing
kStatus kWebSocket_SendPing(kWebSocket webSocket)
Sends a ping message.
kWebSocket::kWebSocket_Close
kStatus kWebSocket_Close(kWebSocket webSocket)
Closes the WebSocket connection.
kWebSocket::kWebSocket_SetReadBuffers
kStatus kWebSocket_SetReadBuffers(kWebSocket webSocket, kSSize socketSize, kSSize clientSize)
Sets the size of the read buffers.
kWebSocket::kWebSocket_Receive
kStatus kWebSocket_Receive(kWebSocket webSocket, k64u timeout)
Blocks until a new message is available for reading.
kWebSocket::kWebSocket_Connect
kStatus kWebSocket_Connect(kWebSocket webSocket, kIpAddress address, k32u port, const kChar *host, const kChar *uri, k64u timeout)
Connects a WebSocket to an HTTP server.