WebSocket - stingray.WebSocket object reference - Stingray Lua API Reference

stingray.WebSocket object reference

Description

Implements a web socket client interface.

Enumerations

Supported message types.
Websocket states

Functions

Parameters

self :

stingray.WebSocket

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns
This function does not return any values.
Parameters

self :

stingray.WebSocket

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

MessageType?

The type of the returned payload, TEXT or BINARY. If there is no new data, nil is returned.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

string?

The payload of the message or nil if there was no new data.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Parameters

self :

stingray.WebSocket

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

msg :

string

The string to send over the websocket.

type :

stingray.WebSocket.MessageType?

The type of the message, TEXT or BINARY. This defaults to TEXT unless specified.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.
Parameters

self :

stingray.WebSocket

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

State

The current state of the web socket.