protocol

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Http

type Http struct {
	// Addr is the address the HTTP server will bind to.
	Addr string

	// Port is the port the HTTP server will run on.
	Port int

	// ResponseCode is the response which out endpoint will return.
	// Default is 200 if no response code is passed.
	ResponseCode int
	// contains filtered or unexported fields
}

Http is the protocol for accepting http requests.

func (*Http) Start

func (s *Http) Start(c []chan RequestPayload, quits []chan int, errors []chan int)

Start will start the HTTP server.

Sets the channel on our struct so that incoming requests can be sent over it.

In the case that we cannot start this server, we send a signal to our quit channel to close renderers.

type Protocol

type Protocol interface {
	Start([]chan RequestPayload, []chan int, []chan int)
}

Protocol is the interface for the servers that accept incoming requests. Incoming requests are then sent to the renderers through the RequestPayload channel. If a protocol closes(ie: from and error), we use the second channel which is used to send an int(1 signals quit).

type RequestPayload

type RequestPayload struct {
	ID          string                   `json:"id"`
	Fields      logrequest.RequestFields `json:"fields"`
	Headers     map[string][]string      `json:"headers"`
	Message     string                   `json:"message"`
	ParamFields logparams.ParamFields    `json:"paramFields"`
	CreatedAt   time.Time                `json:"createdAt"`
}

RequestPayload is the request payload we receive from an incoming request that we use with the renderers.

type Ws added in v1.2.0

type Ws struct {
	// Addr is the address the WS server will bind to.
	Addr string

	// Port is the port the WS server will run on.
	Port int
	// contains filtered or unexported fields
}

Ws is the protocol for accepting WS connections and messages.

func (*Ws) Start added in v1.2.0

func (ws *Ws) Start(c []chan RequestPayload, quits []chan int, errors []chan int)

Start will start the WebSocket server.

Sets the channel on our struct so that incoming message can be sent over it.

In the case that we cannot start this server, we send a signal to our quit channel to close renderers.

Jump to

Keyboard shortcuts

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