Interface: WebSocket

olympe.net. WebSocket

Web socket interface.

Methods


close()

Closes the socket.


<abstract> isOpen()

Checks whether the web socket is opened or not.

Returns:

true if the socket is opened.

Type
boolean

<abstract> send(data)

Sends a message through the socket.

Parameters:
Name Type Description
data string

The message.

Returns:

success

Type
boolean

setCloseHandler(callback)

Sets the 'close' event handler.

Parameters:
Name Type Argument Description
callback olympe.net.WebSocket.StatusHandler <nullable>

On close callback function or null to unregister


setDataHandler(callback)

Sets the 'data' event handler.

Parameters:
Name Type Argument Description
callback olympe.net.WebSocket.DataHandler <nullable>

On data callback function or null to unregister


setErrorHandler(callback)

Sets the 'error' event handler.

Parameters:
Name Type Argument Description
callback olympe.net.WebSocket.ErrorHandler <nullable>

On error callback function or null to unregister


setOpenHandler(callback)

Sets the 'open' event handler.

Parameters:
Name Type Argument Description
callback olympe.net.WebSocket.StatusHandler <nullable>

On open callback function or null to unregister

Type Definitions


DataHandler()

DataHandler(data)


ErrorHandler()


StatusHandler()