package
Version:
v0.0.2
Opens a new window with list of versions in this module.
Published: Sep 13, 2021
License: Apache-2.0
Opens a new window with license information.
Imports: 17
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
SurgeMQ Standalone Server
下面未更新,不要使用,采用配置文件的方式配置了
Build
Usage
Command line options
-help
: Shows complete list of supported options
-auth string
: Authenticator Type (default "mockSuccess")
-keepalive int
: Keepalive (sec) (default 300)
-sessions string
: Session Provider Type (default "mem")
-topics string
: Topics Provider Type (default "mem")
-wsaddr string
: HTTP websocket listener address, (eg. ":8080") (default none)
-wssaddr string
: HTTPS websocket listener address, (eg. ":8443") (default none)
-wsscertpath string
: HTTPS listener public key file, (eg. "certificate.pem") (default none)
-wsskeypath string
: HTTPS listener private key file, (eg. "key.pem") (default none)
Websocket listener
- In addition to listening for MQTT traffic on port 1883, the standalone server can be configured to listen for websocket over HTTP or HTTPS.
mq -wsaddr :8080
will start the server to listen for Websocket on port 8080
Self-signed Websocket listener
The following steps will setup the server to use a self-signed certificate.
-
Generate a self-signed TLS certificate:
openssl genrsa -out key.pem 2048; openssl req -new -key key.pem -out csr.pem; openssl req -x509 -days 365 -key key.pem -in csr.pem -out certificate.pem
-
Start standalone server: surgemq.exe -wssaddr :8443 -wsscertpath certificate.pem -wsskeypath key.pem
-
For self-signed certificate, add a security exception to the browser (eg: http://www.poweradmin.com/help/sslhints/firefox.aspx)
Testing
Websocket support has been tested with the HiveMQ websocket client at http://www.hivemq.com/demos/websocket-client/
Documentation
¶
func DefaultListenAndServeWebsocket() error
start a listener that proxies websocket <-> tcp
handler that proxies websocket <-> unix domain socket
Source Files
¶
Click to show internal directories.
Click to hide internal directories.