api_ws

package
v0.0.0-...-ddfce29 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHAN_MESSAGE_MAX           = 1024
	CHAN_MESSAGE_BROADCAST_MAX = 100
	CHAN_MESSAGE_FAILED_MAX    = 100
	LOST_MESSAGE_MAX_LIFE      = 30 * time.Second
)

Variables

This section is empty.

Functions

func CloseAuthdConn

func CloseAuthdConn(id string)

Closes authenticated connection by ID.

func ConnsInfoAuthd

func ConnsInfoAuthd() (infos []map[string]interface{})

func CorePulseProc

func CorePulseProc(req *reqres.Req) (data interface{}, err error)

Response to pulse by returning current app deployment info.

func DeregisterConn

func DeregisterConn(ws *Conn)

Deregisteres connection by removing it from the registry.

func DumpConnsAuthd

func DumpConnsAuthd(header string) string

func DumpConnsPublic

func DumpConnsPublic(header string) string

func GetBroadcaster_Authd

func GetBroadcaster_Authd() func(string, interface{}) (err error)

Returns authenticated broadcaster.

func GetBroadcaster_Public

func GetBroadcaster_Public() func(string, interface{}) (err error)

Returns public broadcaster.

func Handle

func Handle(w http.ResponseWriter, r *http.Request, router *reqres.WebSocket_Router, isAuthd bool)

Creates WS connecttion and processes it in forever loop.

func Handle_NotAuthd

func Handle_NotAuthd(w http.ResponseWriter, r *http.Request)

Handles WS Not Authd response.

func Initialize

func Initialize(verGetter func() string, onPanic func(string, string, ...interface{})) (err error)

Initializes websocket package. OnPanic handler must be provided.

func NewResponse

func NewResponse(req *reqres.Req, data interface{}) []byte

Marshals successful data response.

func NewResponse_Broadcast

func NewResponse_Broadcast(id int, op string, data interface{}) []byte

Marshals broadcast response.

func NewResponse_Err

func NewResponse_Err(req *reqres.Req, err *errors.ResError) []byte

Marshals error condition.

func ParseReq

func ParseReq(raw []byte) (req *reqres.Req, err error)

Parses JSON request into a map. May return ApiErr if parse failed.

func RegisterConn

func RegisterConn(ws *Conn)

Registers open connection based on session ID.

func Respond

func Respond(conn *Conn, res []byte) (err error)

Responds on websocket connection.

Types

type Conn

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

func GetConn

func GetConn(isAuthd bool, agentId string) (ws *Conn)

Finds connection that corresponds to agentId.

type Message

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

Jump to

Keyboard shortcuts

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