A thin wrapper of the httpuv package, modified to serve animated plots.

Public fields

app

A list of functions that define the application.

server

A server handle to be used by 'stopServer'.

ws

A WebSocket channel to handle the communication between the R session and the browser session.

in_handler

A function to handle instructions sent by the browser session.

port

An integer; the TCP port number.

connected

TRUE or FALSE; whether a connection has been established. One should start the WebSocket server before launching the web page that connects to the server.

started

TRUE or FALSE; whether a server has been started. Use the startServer method to start a server.

Methods


Method startServer()

Start a WebSocket server

Usage

websocket$startServer()


Method stopServer()

Stop a WebSocket server

Usage

websocket$stopServer()


Method listServers()

List all running WebSocket servers

Usage

websocket$listServers()


Method stopAllServers()

Stop all running WebSocket servers

Usage

websocket$stopAllServers()


Method new()

Initialise a WebSocket connection

Usage

websocket$new(in_handler, port = 9454)

Arguments

in_handler

A function to handle incoming message, default to be print which only displays the message without any processing.

port

An integer; the TCP port number.

Returns

A 'websocket' object.


Method clone()

The objects of this class are cloneable with this method.

Usage

websocket$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.