wshub

package
v0.0.0-...-93b0e25 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

* @Author: * @Date: 2022-12-21 12:39:14 * @LastEditors: Please set LastEditors * @LastEditTime: 2022-12-23 11:23:36 * @Description:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Group    string
	ConnId   string
	RcvBuff  []byte
	BufPos   int
	BufState int
	// contains filtered or unexported fields
}

type Hub

type Hub struct {
	Upgrader       *websocket.Upgrader
	WriteWait      time.Duration
	PongWait       time.Duration
	PingPeriod     time.Duration
	MaxMessageSize int64
	// contains filtered or unexported fields
}

func Init

func Init() *Hub

func (*Hub) GetToConn

func (h *Hub) GetToConn(group, connId string) (*Connection, bool)

func (*Hub) Listen

func (h *Hub) Listen(c *Connection, messageHandler func(messageType int, message []byte)) error

func (*Hub) Open

func (h *Hub) Open(group, connId string, res http.ResponseWriter, req *http.Request) (*Connection, error)

func (*Hub) RemoveConn

func (h *Hub) RemoveConn(c *Connection)

func (*Hub) RemoveGroup

func (h *Hub) RemoveGroup(groupName string)

func (*Hub) WriteEveryGroupOneConn

func (h *Hub) WriteEveryGroupOneConn(messageType int, message []byte) error

func (*Hub) WriteOnConn

func (h *Hub) WriteOnConn(c *Connection, messageType int, message []byte) error

func (*Hub) WriteOnGroup

func (h *Hub) WriteOnGroup(group string, messageType int, message []byte)

func (*Hub) WriteOneConn

func (h *Hub) WriteOneConn(group string, messageType int, message []byte) error

Jump to

Keyboard shortcuts

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