websocket#

Tutorials#

Variables#

Constructors#

websocket

websocket(char32[] url)

Functions#

void

GetError(char32[] buf)

void

Send(char32[] buf, WebsocketType type = WEBSOCKET_MESSAGE_TYPE_TEXT)

untyped[]

Receive()

void

Free() deprecated

void

Own()

Enumerations#

enum WebsocketState: 🔗 Source

WebsocketState WEBSOCKET_STATE_CONNECTING = 0L

WebsocketState WEBSOCKET_STATE_OPEN = 1L

WebsocketState WEBSOCKET_STATE_CLOSING = 2L

WebsocketState WEBSOCKET_STATE_CLOSED = 3L


enum WebsocketType: 🔗 Source

WebsocketType WEBSOCKET_MESSAGE_TYPE_TEXT = 1L

send text data

WebsocketType WEBSOCKET_MESSAGE_TYPE_BINARY = 2L

send binary data


Variable descriptions#

const WebsocketState State 🔗 Source

Current state of the websocket.


const bool HasMessage 🔗 Source

True if there is a message waiting to be received.


const WebsocketType MessageType 🔗 Source


char32 URL 🔗 Source


Constructor descriptions#

websocket websocket(char32[] url) 🔗 Source


Function descriptions#

void GetError(char32[] buf) 🔗 Source

Gets the current websocket error message (if any).


void Send(char32[] buf, WebsocketType type = WEBSOCKET_MESSAGE_TYPE_TEXT) 🔗 Source

Sends a message over the websocket.


untyped[] Receive() 🔗 Source

If HasMessage is true, returns a pointer to the websocket’s internal data array representing the next message in the queue. If there is no message, returns NULL.

Calling this function again will overwrite the contents of this array.

The array is destroyed automatically when the websocket is freed.


void Free() 🔗 Source

DEPRECATED: This no longer does anything - objects are freed automatically now.

See “Object Memory Management” section

This will deallocate the websocket pointer, so that the pointer ID may be re-used.

There is a limit to how many websocket pointers may be allocated at once, so be sure to free them when you are no longer using them.

Warning

Deprecated! Free() no longer does anything as of ZC 3.0. Objects are now freed automatically.


void Own() 🔗 Source

Grants ‘Ownership’ of the pointer to the currently running script.

*pre-3.0*: When the script terminates (at the same time any Local Arrays in the script are cleared), the pointer will be automatically freed.

See “Object Memory Management” section