socket

package
v0.0.0-...-dddd691 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Text   = 1
	Binary = 2
	Close  = 8
	Ping   = 9
	Pong   = 10

	String = 1
	Bytes  = 2
)

Variables

View Source
var Err_CloseIntent = errors.New("Close by you")

Functions

func AddRouter

func AddRouter(httpPath string, handlerBuilder func() IHandler)

func AddRouterAtServer

func AddRouterAtServer(server *web.HttpServer, httpPath string, handlerBuilder func() IHandler)

Types

type Handler

type Handler struct {
	web.Handler

	Conn *ws.Conn
	// contains filtered or unexported fields
}

func (*Handler) Close

func (this *Handler) Close()

func (*Handler) Handle

func (this *Handler) Handle()

func (*Handler) OnConnect

func (this *Handler) OnConnect()

func (*Handler) OnDisconnect

func (this *Handler) OnDisconnect(e error)

func (*Handler) OnMessage

func (this *Handler) OnMessage(msgType int, body []byte) error

func (*Handler) ResponseHeaders

func (this *Handler) ResponseHeaders(headers map[string][]string)

func (*Handler) Send

func (this *Handler) Send(msgType int, body []byte) error

type IHandler

type IHandler interface {
	web.IHandler

	OnConnect()
	OnDisconnect(error)
	OnMessage(msgType int, body []byte) error
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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