Learn R Programming

websockets (version 1.1.7)

static_text_service: Serve a static web page from a file.

Description

This utility function closure serves a static web page from a character string.

Usage

static_text_service(text)

Arguments

text

The HTML web page as a character string.

Value

The function returned by this closure must return a valid HTTP response.

Details

A function of two arguments, socket and header is returned. The socket argument indicates the low-level socket descriptor of the websocket client. The header argument contains a parsed HTTP GET request. When invoked, the function may examine the GET request and respond accordingly, usually with a valid HTTP 200 response, or a 40* response indicating an error.

See Also

create_server, static_file_service

Examples

Run this code
# NOT RUN {
# See the detailed example in help('websockets').
# }

Run the code above in your browser using DataLab