textchat

package
v0.0.0-...-9402fd8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChatClient

func NewChatClient(clientID string, ws *cws.Client, broadcastCh chan ChatMessage, wsEvents chan cws.WSPacket) *chatClient

NewChatClient returns a new chat client

Types

type ChatMessage

type ChatMessage struct {
	User    string `json:"user"`
	Message string `json:"message"`
}

type TextChat

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

TextChat is the service to handle all chat over websocket

func NewTextChat

func NewTextChat() *TextChat

NewTextChat spawns a new text chat

func (*TextChat) AddClient

func (t *TextChat) AddClient(clientID string, ws *cws.Client) *chatClient

AddClient add a new chat client to TextChat

func (*TextChat) Handle

func (t *TextChat) Handle()

Handle is main handler for TextChat

func (*TextChat) SendChatHistory

func (t *TextChat) SendChatHistory(clientID string)

SendChatHistory sends chat history to all clients

Jump to

Keyboard shortcuts

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