websocket

command
v2.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

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.

Documentation

Overview

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 "PUB <count> <time>" each second
  • req/ - REQ socket, responds with a reply "REPLY <count> <time>"
  • static/ - static content, provided as ASCII "STATIC"

To use:

$ go build .
$ port=40899
$ ./websocket server port & pid=$! && sleep 1
$ ./websocket req $port
$ ./websocket sub $port
$ ./websocket static $port
$ kill $pid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL