handlers

package
v0.0.0-...-7f3d0a8 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Home

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

Home renders the home page.

func ListenForWs

func ListenForWs(conn WebSocketConnection)

func ListenToWsChannel

func ListenToWsChannel()

func WsEndpoint

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

WsEndpoint upgrades connection to websocket.

Types

type WebSocketConnection

type WebSocketConnection struct {
	*websocket.Conn
}

type WsJSONResponse

type WsJSONResponse struct {
	Action         string   `json:"action"`
	Message        string   `json:"message"`
	MessageType    string   `json:"message_type"`
	ConnectedUsers []string `json:"connected_users"`
}

WsJSONResponse defines the response sent back from websocket.

type WsPayload

type WsPayload struct {
	Action   string              `json:"action"`
	Username string              `json:"username"`
	Message  string              `json:"message"`
	Conn     WebSocketConnection `json:"-"`
}

Jump to

Keyboard shortcuts

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