server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l *zap.SugaredLogger)

Types

type MessageHandler

type MessageHandler interface {
	HandleMessage(conn *websocket.Conn, message []byte)
}

type NotificationService

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

func NewNotificationService

func NewNotificationService() *NotificationService

func (*NotificationService) AddSubscriber

func (n *NotificationService) AddSubscriber(conn *websocket.Conn)

func (*NotificationService) BroadcastMessageToSubscribers

func (n *NotificationService) BroadcastMessageToSubscribers(message []byte)

func (*NotificationService) RemoveSubscriber

func (n *NotificationService) RemoveSubscriber(conn *websocket.Conn)

type Server

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

func NewServer

func NewServer() *Server

NewServer creates a new instance of server.

func (*Server) Close

func (s *Server) Close() error

func (*Server) GetWorkerService

func (s *Server) GetWorkerService() *WorkerService

GetWorkerService returns the worker service.

func (*Server) Run

func (s *Server) Run(addr string) error

Run listens on the specified port and serve requests.

func (*Server) StartLoadTest

func (s *Server) StartLoadTest(r *messages.StartLoadTestRequest)

func (*Server) StopLoadTest

func (s *Server) StopLoadTest()

type WorkerService

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

func NewWorkerService

func NewWorkerService() *WorkerService

func (*WorkerService) AddWorker

func (w *WorkerService) AddWorker(conn *websocket.Conn, name string)

func (*WorkerService) BroadcastMessageToWorkers

func (w *WorkerService) BroadcastMessageToWorkers(message []byte)

func (*WorkerService) GetMessageHandler

func (w *WorkerService) GetMessageHandler() MessageHandler

func (*WorkerService) RemoveWorker

func (w *WorkerService) RemoveWorker(conn *websocket.Conn)

func (*WorkerService) SetMessageHandler

func (w *WorkerService) SetMessageHandler(h MessageHandler)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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