server

command
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package server provides a sample HTTP/Websocket server which registers itself in consul using one or more url prefixes to demonstrate and test the automatic fabio routing table update.

During startup the server performs the following steps:

  • Add a handler for each prefix which provides a unique response for that instance and endpoint
  • Add a `/health` handler for the consul health check
  • Register the service in consul with the listen address, a health check under the given name and with one `urlprefix-` tag per prefix
  • Install a signal handler to deregister the service on exit

If the protocol is set to "ws" the registered endpoints function as websocket echo servers.

Example:

# http server
./server -addr 127.0.0.1:5000 -name svc-a -prefix /foo,/bar
./server -addr 127.0.0.1:5001 -name svc-b -prefix /baz,/bar

# websocket server
./server -addr 127.0.0.1:6000 -name ws-a -prefix /echo1,/echo2 -proto ws

Jump to

Keyboard shortcuts

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