Simple HTTP server
Notes:
| Signature | hs.httpserver.new([ssl], [bonjour]) -> object |
|---|---|
| Type | Function |
| Description | Creates a new HTTP or HTTPS server |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:getInterface() -> string or nil |
|---|---|
| Type | Method |
| Description | Gets the network interface the server is configured to listen on |
| Parameters |
|
| Returns |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:getName() -> string |
|---|---|
| Type | Method |
| Description | Gets the Bonjour name the server is configured to advertise itself as |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:getPort() -> number |
|---|---|
| Type | Method |
| Description | Gets the TCP port the server is configured to listen on |
| Parameters |
|
| Returns |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:maxBodySize([size]) -> object | current-value |
|---|---|
| Type | Method |
| Description | Get or set the maximum allowed body size for an incoming HTTP request. |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:send(message) -> object |
|---|---|
| Type | Method |
| Description | Sends a message to the websocket client |
| Parameters |
|
| Returns |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:setCallback([callback]) -> object |
|---|---|
| Type | Method |
| Description | Sets the request handling callback for an HTTP server object |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:setInterface(interface) -> object |
|---|---|
| Type | Method |
| Description | Sets the network interface the server is configured to listen on |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:setName(name) -> object |
|---|---|
| Type | Method |
| Description | Sets the Bonjour name the server should advertise itself as |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:setPassword([password]) -> object |
|---|---|
| Type | Method |
| Description | Sets a password for an HTTP server object |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:setPort(port) -> object |
|---|---|
| Type | Method |
| Description | Sets the TCP port the server is configured to listen on |
| Parameters |
|
| Returns |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:start() -> object |
|---|---|
| Type | Method |
| Description | Starts an HTTP server object |
| Parameters |
|
| Returns |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:stop() -> object |
|---|---|
| Type | Method |
| Description | Stops an HTTP server object |
| Parameters |
|
| Returns |
|
| Source | extensions/httpserver/internal.m |
| Signature | hs.httpserver:websocket(path, callback) -> object |
|---|---|
| Type | Method |
| Description | Enables a websocket endpoint on the HTTP server |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/httpserver/internal.m |