#hs.httpserver
Simple HTTP server
Notes:
- Running an HTTP server is potentially dangerous, you should seriously consider the security implications of exposing your Hammerspoon instance to a network - especially to the Internet
- As a user of Hammerspoon, you are assumed to be highly capable, and aware of the security issues
#Submodules
#API Overview
Functions - API calls offered directly by the extension
Methods - API calls which can only be made on an object returned by a constructor
- getInterface
- getName
- getPort
- maxBodySize
- send
- setCallback
- setInterface
- setName
- setPassword
- setPort
- start
- stop
- websocket
#API Documentation
#Functions
Signature | hs.httpserver.new([ssl], [bonjour]) -> object |
Type | Function |
Description | Creates a new HTTP or HTTPS server |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 374 |
#Methods
Signature | hs.httpserver:getInterface() -> string or nil |
Type | Method |
Description | Gets the network interface the server is configured to listen on |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 647 |
Signature | hs.httpserver:getName() -> string |
Type | Method |
Description | Gets the Bonjour name the server is configured to advertise itself as |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 689 |
Signature | hs.httpserver:getPort() -> number |
Type | Method |
Description | Gets the TCP port the server is configured to listen on |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 616 |
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 |
|
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 513 |
Signature | hs.httpserver:send(message) -> object |
Type | Method |
Description | Sends a message to the websocket client |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 446 |
Signature | hs.httpserver:setCallback([callback]) -> object |
Type | Method |
Description | Sets the request handling callback for an HTTP server object |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 466 |
Signature | hs.httpserver:setInterface(interface) -> object |
Type | Method |
Description | Sets the network interface the server is configured to listen on |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 662 |
Signature | hs.httpserver:setName(name) -> object |
Type | Method |
Description | Sets the Bonjour name the server should advertise itself as |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 707 |
Signature | hs.httpserver:setPassword([password]) -> object |
Type | Method |
Description | Sets a password for an HTTP server object |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 539 |
Signature | hs.httpserver:setPort(port) -> object |
Type | Method |
Description | Sets the TCP port the server is configured to listen on |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 631 |
Signature | hs.httpserver:start() -> object |
Type | Method |
Description | Starts an HTTP server object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 573 |
Signature | hs.httpserver:stop() -> object |
Type | Method |
Description | Stops an HTTP server object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 599 |
Signature | hs.httpserver:websocket(path, callback) -> object |
Type | Method |
Description | Enables a websocket endpoint on the HTTP server |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/httpserver/libhttpserver.m line 415 |