server

package
v0.0.0-...-3d82958 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is a network server

func NewServer

func NewServer(addr string, op ...ServerOption) *Server

NewServer creates a less server

func (*Server) Run

func (srv *Server) Run()

Run listens transport address and serving for channel and message request

func (*Server) Shutdown

func (srv *Server) Shutdown()

Shutdown stops the Server, closes the transporter and all channels

type ServerOption

type ServerOption func(options *serverOptions)

func DisableGoPool

func DisableGoPool() ServerOption

DisableGoPool disables ants goroutine pool

func KeepaliveParams

func KeepaliveParams(kp keepalive.ServerParameters) ServerOption

KeepaliveParams sets keepalive parameters

func MaxChannelSize

func MaxChannelSize(size uint32) ServerOption

MaxChannelSize sets the max size of channels

func MaxGoPoolCapacity

func MaxGoPoolCapacity(size int) ServerOption

MaxGoPoolCapacity sets the max size of ants goroutine pool

func MaxReceiveMessageSize

func MaxReceiveMessageSize(size uint32) ServerOption

MaxReceiveMessageSize sets the max size of message when receive

func MaxSendMessageSize

func MaxSendMessageSize(size uint32) ServerOption

MaxSendMessageSize sets the max size of message when send

func WithInboundMiddleware

func WithInboundMiddleware(mws ...less.Middleware) ServerOption

WithInboundMiddleware adds inbound middlewares

func WithOnChannel

func WithOnChannel(onChannel ...less.OnChannel) ServerOption

WithOnChannel adds channel request hooks

func WithOnChannelClosed

func WithOnChannelClosed(onChannelClosed ...less.OnChannelClosed) ServerOption

WithOnChannelClosed adds channel closed hooks

func WithOutboundMiddleware

func WithOutboundMiddleware(mws ...less.Middleware) ServerOption

WithOutboundMiddleware adds outbound middlewares

func WithRouter

func WithRouter(router router.Router) ServerOption

WithRouter sets message router

func WithTransport

func WithTransport(transport transport.Transport) ServerOption

WithTransport sets transporter

Jump to

Keyboard shortcuts

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