stream

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WEBSOCK = ConnectType("websock")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ConnType  ConnectType
	Connect   *websocket.Conn
	Ip        string
	Referer   string
	UserAgent string
	Width     int
	Height    int
	Cookie    bool
	Language  string
	Platform  string
	Location  string
	Href      string

	// message buffered channel
	Send chan []byte
}

func (*Client) Close

func (c *Client) Close()

func (*Client) Notify

func (c *Client) Notify(t, b string)

func (*Client) UpdateInfo

func (c *Client) UpdateInfo(info interface{})

func (*Client) Write

func (c *Client) Write(opCode int, payload []byte) error

func (*Client) WritePump

func (c *Client) WritePump()

send message to client

type ConnectType

type ConnectType string

type Hub

type Hub struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewHub

func NewHub() *Hub

func (*Hub) AddClient

func (h *Hub) AddClient(client *Client)

func (*Hub) Broadcast

func (h *Hub) Broadcast(message []byte)

func (*Hub) Clients

func (h *Hub) Clients() (clients []*Client)

func (*Hub) Recv

func (h *Hub) Recv(client *Client, message []byte)

func (*Hub) Run

func (h *Hub) Run()

func (*Hub) Send

func (h *Hub) Send(client *Client, message []byte)

func (*Hub) Subscribe

func (h *Hub) Subscribe(command string, f func(client *Client, value interface{}))

func (*Hub) UnSubscribe

func (h *Hub) UnSubscribe(command string)

type StreamService

type StreamService struct {
	Hub *Hub
}

func NewStreamService

func NewStreamService(hub *Hub) *StreamService

func (*StreamService) AddClient

func (s *StreamService) AddClient(client *Client)

func (*StreamService) Broadcast

func (s *StreamService) Broadcast(message []byte)

func (*StreamService) Subscribe

func (s *StreamService) Subscribe(command string, f func(client *Client, value interface{}))

func (*StreamService) UnSubscribe

func (s *StreamService) UnSubscribe(command string)

func (*StreamService) Ws

func (w *StreamService) Ws(ctx *gin.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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