ws

package
v0.0.0-...-0d40728 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SolutionHandler

func SolutionHandler(client *compute.Client, metadataCtor apiModel.MetadataStorageCtor,
	dataCtor apiModel.DataStorageCtor, solutionCtor apiModel.SolutionStorageCtor,
	modelCtor apiModel.ExportedModelStorageCtor) func(http.ResponseWriter, *http.Request)

SolutionHandler represents a solution websocket handler.

Types

type Connection

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

Connection represents a single clients tile dispatcher.

func NewConnection

func NewConnection(w http.ResponseWriter, r *http.Request, handler requestHandler) (*Connection, error)

NewConnection returns a pointer to a new tile dispatcher object.

func (*Connection) Close

func (c *Connection) Close()

Close closes the dispatchers websocket connection.

func (*Connection) ListenAndRespond

func (c *Connection) ListenAndRespond() error

ListenAndRespond waits on both tile request and responses and handles each until the websocket connection dies.

func (*Connection) SendResponse

func (c *Connection) SendResponse(res interface{}) error

SendResponse will send a json response in a thread safe manner.

type Message

type Message struct {
	Type      string          `json:"type"`
	ID        string          `json:"id"`
	Timestamp time.Time       `json:"-"`
	Body      json.RawMessage `json:"body"`
}

Message represents a websocket message.

func NewMessage

func NewMessage(bytes []byte) (*Message, error)

NewMessage parses and instantiates a new message struct.

Jump to

Keyboard shortcuts

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