Discover Packages
github.1git.de/nanomsg/mangos
examples
websocket
command
Version:
v2.0.0+incompatible
Opens a new window with list of versions in this module.
Published: Nov 2, 2018
License: Apache-2.0
Opens a new window with license information.
Imports: 12
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
This code demonstrates how to use multiple mangos sockets on a single
WebSocket port, sharing an http server instance between a REQ/REP socket,
a PUB/SUB socket, and a static handler.
See the run.sh script for instructions as to how to run it.
Expand ▾
Collapse ▴
Documentation
¶
websocket implements a simple websocket server for mangos, demonstrating
how to use multiplex multiple sockets on a single HTTP server instance.
The server listens, and offers three paths:
sub/ - SUB socket, publishes a message "BING!" once per second
req/ - REQ socket, responds with a reply "REPLY"
static/ - static content, provided as ASCII "STATIC"
To use:
$ go build .
$ url=tcp://127.0.0.1:40899
$ ./websocket server $url & pid=$! && sleep 1
$ ./websocket req $url
$ ./websocket sub $url
$ ./websocket static $url
$ kill $pid
Source Files
¶
Click to show internal directories.
Click to hide internal directories.