livechat

package
v0.0.0-...-df62f9d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLiveChatHandler

func GetLiveChatHandler(sm *SocketManager) gin.HandlerFunc

Types

type AuthData

type AuthData struct {
	Token string `json:"token"`
}

type Client

type Client struct {
	Manager       *SocketManager
	Ws            *websocket.Conn
	RequestCtx    *gin.Context
	Authenticated bool
	GuildId       uint64
	TicketId      int
	// contains filtered or unexported fields
}

func NewClient

func NewClient(manager *SocketManager, ws *websocket.Conn, c *gin.Context, guildId uint64, ticketId int) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Flush

func (c *Client) Flush()

func (*Client) HandleEvent

func (c *Client) HandleEvent(event Event) error

func (*Client) StartReadLoop

func (c *Client) StartReadLoop() error

func (*Client) StartWriteLoop

func (c *Client) StartWriteLoop() error

func (*Client) Write

func (c *Client) Write(msg any)

type ErrorMessage

type ErrorMessage struct {
	Error string `json:"error"`
}

func NewErrorMessage

func NewErrorMessage(message string) ErrorMessage

type Event

type Event struct {
	Type EventType       `json:"type"`
	Data json.RawMessage `json:"data,omitempty"`
}

type EventType

type EventType string
const (
	EventTypeAuth          EventType = "auth"
	EventTypeAuthenticated EventType = "authenticated"
	EventTypeMessage       EventType = "message"
)

type SocketManager

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

func NewSocketManager

func NewSocketManager() *SocketManager

func (*SocketManager) BroadcastMessage

func (sm *SocketManager) BroadcastMessage(message chatrelay.MessageData)

func (*SocketManager) Run

func (sm *SocketManager) Run()

Jump to

Keyboard shortcuts

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