Skip to content

HTTP Server Class Pattern

The HTTP Server Class Pattern responds to HTTP/1.1 requests.

import HTTPServer from "embedded:network/http/server";

Creates a new HTTPServer object instance.

HTTPServer(options)

options

io - An object containing a TCP Listener class constructor options object.

port - The port number to listen on.

onConnect(connection) - A callback function invoked when a new connection is initiated.

Closes the server and all active connections.

HTTP Server Class Pattern