websocket

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Id string
	// contains filtered or unexported fields
}

type Clients

type Clients struct {
	sync.Mutex

	Router *Router `inject:""`
	// contains filtered or unexported fields
}

func (*Clients) SendToAll

func (r *Clients) SendToAll(t string, data interface{})

Message all the other clients

func (*Clients) WebsocketRoute

func (clients *Clients) WebsocketRoute(c *gin.Context)

type ErrNoSuchRoute

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

func (*ErrNoSuchRoute) Error

func (self *ErrNoSuchRoute) Error() string

type Message

type Message struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data"`
	To   string          `json:"to"`
}

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) AddClientConnectHandler

func (w *Router) AddClientConnectHandler(handler func() *Message)

func (*Router) AddRoute

func (w *Router) AddRoute(route string, handler func(*Message))

func (*Router) Run

func (w *Router) Run(msg *Message) error

func (*Router) RunOnClientConnectHandlers

func (w *Router) RunOnClientConnectHandlers() []*Message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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