branch: externals/websocket
commit 7422064ea6d39dc256fd4e583f13579602772536
Author: Christopher Warrington <[email protected]>
Commit: Christopher Warrington <[email protected]>
Add a way to specify websocket-server listen host
This adds the `:host' keyword to `websocket-server', which lets the
listen host be controlled. This is useful when you only want to listen
on localhost, potentially avoiding things like firewall prompts.
---
websocket.el | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/websocket.el b/websocket.el
index 1b0b29436a..3b048da95c 100644
--- a/websocket.el
+++ b/websocket.el
@@ -820,6 +820,11 @@ of populating the list of server extensions to WEBSOCKET."
(defun* websocket-server (port &rest plist)
"Open a websocket server on PORT.
+If the plist contains a `:host' HOST pair, this value will be
+used to configure the addresses the socket listens on. The symbol
+`local' specifies the local host. If unspecified or nil, the
+socket will listen on all addresses.
+
This also takes a plist of callbacks: `:on-open', `:on-message',
`:on-close' and `:on-error', which operate exactly as documented
in the websocket client function `websocket-open'. Returns the
@@ -833,6 +838,7 @@ connection, which should be kept in order to pass to
:log 'websocket-server-accept
:filter-multibyte nil
:plist plist
+ :host (plist-get plist :host)
:service port)))
conn))