controllers

package
v0.0.0-...-210eee0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewUserMessage = "New User"
	ChatMessage    = "Chat"
	LeaveMessage   = "Leave"
)

Variables

View Source
var Conns = make([]*WebSocketConnection, 0)
View Source
var Upgrader = websocket.Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
}

Functions

func BroadcastMessage

func BroadcastMessage(currConn *WebSocketConnection, msgType string, message string)

func Content

func Content(w http.ResponseWriter, r *http.Request)

func EjectConnection

func EjectConnection(currConn *WebSocketConnection)

func IoHandle

func IoHandle(currConn *WebSocketConnection, conns []*WebSocketConnection)

func WebSocket

func WebSocket(w http.ResponseWriter, r *http.Request)

Types

type SocketPayload

type SocketPayload struct {
	Message string
}

type SocketResponse

type SocketResponse struct {
	User        string
	MessageType string
	Message     string
}

type WebSocketConnection

type WebSocketConnection struct {
	*websocket.Conn
	Username string
}
var NewConn WebSocketConnection

Jump to

Keyboard shortcuts

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