handlers

package
v0.0.0-...-809b26e Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT 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 home page

func ListenForWs

func ListenForWs(conn *WebSocketConnection)

func ListenToWsChannel

func ListenToWsChannel()

func WsEndPoint

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

WsEndPoint upgrade 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 send back from web socket

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