websocket

package
v0.0.0-...-474f5ca Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port      int                `yaml:"port"`
	Responses map[string]*Stream `yaml:"responses"`
}

Config represents a websocket server configuration

func (*Config) NewServer

func (cfg *Config) NewServer() *WsServer

NewServer creates a new websocket server

func (Config) String

func (cfg Config) String() string

type Stream

type Stream struct {
	Read  *WsResponse `yaml:"read,omitempty"`
	Write *WsResponse `yaml:"write,omitempty"`
}

Stream represents a websocket read/write stream

func (Stream) String

func (response Stream) String() string

type WsResponse

type WsResponse struct {
	Bufsize string         `yaml:"bufsize"`
	Delay   *time.Duration `yaml:"delay,omitempty"`
	Type    *string        `yaml:"type,omitempty"`
}

WsResponse represents a websocket response

func (WsResponse) String

func (tcpResponse WsResponse) String() string

type WsServer

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

WsServer represents a websocket server instance

func (*WsServer) Run

func (srv *WsServer) Run()

Run starts a websocket server

func (*WsServer) Stop

func (srv *WsServer) Stop()

Stop stops a websocket server

Jump to

Keyboard shortcuts

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