net

package
v0.0.0-...-9c16532 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PongWait       = 5 * time.Second
	MaxMessageSize = 1024
	WriteWait      = 5 * time.Second
	PingPeriod     = 100 * time.Millisecond
)

Variables

This section is empty.

Functions

func MessageDown

func MessageDown(builder *flatbuffers.Builder, packetType byte, packet flatbuffers.UOffsetT) []byte

func MessageUp

func MessageUp(builder *flatbuffers.Builder, packetType byte, packet flatbuffers.UOffsetT) []byte

Types

type Connection

type Connection interface {
	// Write writes the contents of a byte array to the connection. It is safe for multiple threads to call Write simultaneously. Write blocks until either the message is sent or the connection is closed.
	Write([]byte)
	// Read reads the next message from a connection. It will block until either a message becomes available or the connection is closed.
	Read() ([]byte, error)
	// Close terminates a connection.
	Close() error
}

Connection provides a simple, generalized interface for networked connections in which there can be one reader and many writers. All connection errors are propagated through subsequent calls; that is, if any method invocation returns an error, all subsequent invocations of any method will also return the same error.

func Websocket

func Websocket(conn *websocket.Conn) Connection

type WebsocketConnection

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

func (*WebsocketConnection) Close

func (c *WebsocketConnection) Close() error

func (*WebsocketConnection) Read

func (c *WebsocketConnection) Read() ([]byte, error)

func (*WebsocketConnection) Write

func (c *WebsocketConnection) Write(message []byte)

Directories

Path Synopsis
builders implements a pool of flatbuffers Builders and prevents data leaks in pool members.
builders implements a pool of flatbuffers Builders and prevents data leaks in pool members.

Jump to

Keyboard shortcuts

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