client

package
v0.0.0-...-683daf5 Latest Latest
Warning

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

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

Documentation

Overview

TODO: Supply clients' http.Request info

Index

Constants

This section is empty.

Variables

View Source
var (
	TextHtml       = Mime("text/html")
	TextCss        = Mime("text/css")
	TextCsv        = Mime("text/csv")
	Javascript     = Mime("application/javascript")
	Multipart      = Mime("multipart/form-data")
	MessagePartial = Mime("message/partial")
	ImagePng       = Mime("image/png")
	ImageGif       = Mime("image/gif")
	ImageJpeg      = Mime("image/jpeg")
	ImageIcon      = Mime("image/x-icon")
	ImageTiff      = Mime("image/tiff")
	AudioMpeg      = Mime("audio/mpeg")
	AudioOgg       = Mime("audio/ogg")
	AudioWav       = Mime("audio/wav")
	VideoMp4       = Mime("video/mp4")
	ArchiveRar     = Mime("application/x-rar-compressed")
	ArchiveTar     = Mime("application/x-tar")
	ArchiveZip     = Mime("application/zip")
	Archive7z      = Mime("application/x-7z-compressed")
	ArchiveBzip    = Mime("application/x-bzip")
	ArchiveBzip2   = Mime("application/x-bzip2")
	FormatJson     = Mime("application/json")
	FormatXml      = Mime("application/xml")
	FormatBinary   = Mime("application/octet-stream")
	FormatPdf      = Mime("application/pdf")
	FormatShell    = Mime("application/x-sh")
	FontTtf        = Mime("font/ttf")
	FontWoff       = Mime("font/woff")
	FontWoff2      = Mime("font/woff2")
)

Functions

func ContentLength

func ContentLength() int64

func Echo

func Echo(message string, args ...interface{})

func Handle

func Handle(handler map[string]interface{}, callEvents <-chan Context)

func Out

func Out(data []byte) (n int, err error)

func RemoteAddress

func RemoteAddress() string

func Run

func Run(handler func(args map[string]string), handlers ...interface{})

func SetHeader

func SetHeader(key string, value interface{}) error

func SetHttpCode

func SetHttpCode(statusCode int)

func SetWriter

func SetWriter(sessionId int64, writer ContentWriter)

func SystemMessage

func SystemMessage(message string)

func With

func With(handlers ...interface{}) []interface{}

Types

type ContentWriter

type ContentWriter interface {
	Writer() io.Writer
}

type Context

type Context struct {
	Name       string
	SessionId  [32]byte
	Method     string
	StatusCode *int
	Message
	Arguments map[string]string
	Rpc       func(string, interface{}, interface{}) error

	*sync.Mutex
}

func (*Context) Call

func (context *Context) Call(functionName string, packet *EchoPacket, ack *bool) error

func (*Context) Lock

func (context *Context) Lock()

func (*Context) SetContentType

func (context *Context) SetContentType(mime string)

func (*Context) Unlock

func (context *Context) Unlock()

func (*Context) Write

func (context *Context) Write(buf []byte) (n int, err error)

func (*Context) WriteHeader

func (context *Context) WriteHeader(statusCode int) error

type EchoPacket

type EchoPacket struct {
	SessionId [32]byte
	Body      []byte
	Code      int
}

type Handler

type Handler interface {
	Lock()
	Unlock()
	Write([]byte) (int, error)
	WriteHeader(statusCode int) error
	Call(string, *EchoPacket, *bool) error
}

type HandlerSessions

type HandlerSessions map[SessionId]Handler

func (HandlerSessions) Get

func (handlerSession HandlerSessions) Get(sessionId SessionId) (handler Handler, ok bool)

func (HandlerSessions) Set

func (handlerSession HandlerSessions) Set(sessionId SessionId, handler Handler)

type Message

type Message url.Values

type Mime

type Mime string

type SessionId

type SessionId int64

func Gid

func Gid() SessionId

func (SessionId) Cleanup

func (sessionId SessionId) Cleanup() (done chan chan func(), ok bool)

func (SessionId) Persist

func (sessionId SessionId) Persist() bool

func (SessionId) Purge

func (sessionId SessionId) Purge()

type SessionSignals

type SessionSignals map[SessionId]chan chan func()

type WriterSessions

type WriterSessions map[SessionId]io.Writer

func (WriterSessions) Get

func (writerSession WriterSessions) Get(sessionId SessionId) (writer io.Writer, ok bool)

func (WriterSessions) Set

func (writerSession WriterSessions) Set(sessionId SessionId, writer io.Writer)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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