server

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 12 Imported by: 5

Documentation

Overview

Package server provides network listeners, e.g. an HTTP (web/REST/JSON) server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSid added in v0.1.8

func AddSid(hdr *http.Header, sid string)

func Authenticate

func Authenticate(ctx *b.Context, spec m.Map, msg b.Message,
	req *http.Request) bool

func DefaultAction

func DefaultAction(
	ctx *b.Context, spec m.Map, msg b.Message,
	rsp http.ResponseWriter, req *http.Request, sid string)

func DoneHandler

func DoneHandler(ctx *b.Context) (loop bool)

func GetSid added in v0.1.8

func GetSid(hdrp *http.Header) string

func LoginAction added in v0.1.8

func LoginAction(
	ctx *b.Context, spec m.Map, msg b.Message,
	rsp http.ResponseWriter, req *http.Request, sid string)

func PollAction

func PollAction(
	ctx *b.Context, spec m.Map, pollmsg b.Message,
	rsp http.ResponseWriter, req *http.Request, sid string)

func Route

func Route(ctx *b.Context, rsp http.ResponseWriter, req *http.Request)

func StartServer

func StartServer(ctx *b.Context)

func SyncAction

func SyncAction(
	ctx *b.Context, spec m.Map, msg b.Message,
	rsp http.ResponseWriter, req *http.Request, sid string)

Types

type RqActionHandler

type RqActionHandler = func(
	*b.Context, m.Map, b.Message, http.ResponseWriter, *http.Request, string)

func GetActionHandler

func GetActionHandler(ctx *b.Context, spec m.Map, msg b.Message) RqActionHandler

type ServerState added in v0.1.8

type ServerState struct {
	Server   *http.Server
	Sessions Sessions
}

func (*ServerState) GetSessionMailbox added in v0.1.8

func (st *ServerState) GetSessionMailbox(sid string) chan b.Message

type Session added in v0.1.8

type Session struct {
	Mailbox chan b.Message
}

type Sessions added in v0.1.8

type Sessions map[string]Session

func (Sessions) CreateSession added in v0.1.8

func (s Sessions) CreateSession() string

func (Sessions) Get added in v0.1.8

func (s Sessions) Get(sid string) (Session, bool)

Jump to

Keyboard shortcuts

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