server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServerClosed = errors.New("server: Server closed")

ErrServerClosed is returned by the Server's ListenAndServe methods after a call to Shutdown or Close.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server listen for incoming request and push them into the hub.

func NewServer

func NewServer(options *config.Options) *Server

NewServer allocates and returns a new Server.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe listens on the TCP socket and then handle requests.

ListenAndServe always returns a non-nil error. After Shutdown or Close, the returned error is ErrServerClosed.

func (*Server) RegisterOnShutdown

func (s *Server) RegisterOnShutdown(f func())

RegisterOnShutdown registers a function to call on Shutdown. This function should start protocol-specific graceful shutdown, but should not wait for shutdown to complete.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown gracefully shuts down the agent without interrupting any active event. Shutdown works by closing stream.

When Shutdown is called, ListenAndServe immediately return ErrServerClosed. Make sure the program doesn't exit and waits instead for Shutdown to return.

Once Shutdown has been called on a server, it may not be reused; future calls to methods such as Serve will return ErrServerClosed.

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

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