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 1. Somebody connects to the webpage: func Home <- display the webpage
func ListenForWs ¶
func ListenForWs(conn *WebSocketConnection)
Goroutine to listen for messages from the websocket 3. When we connect to WS:
- go ListenForWs(&conn) <- is called
- go ListenForWs(&conn) <- is a goroutine on a infite loop
- wsChan <- payload <- everything sent on the payload is pass to wsChan
func ListenToWsChannel ¶
func ListenToWsChannel()
- Everything on the the payload is store on the variable e func ListenToWsChannel() <- everything on the the payload is store on the variable e
- Here is where we process the payload, the logic, where we stract the username or the message.
func WsEndpoint ¶
func WsEndpoint(w http.ResponseWriter, r *http.Request)
WsEndpoint upgrades connection to websocket 2. func WsEndpoint is called to connect the WS
Types ¶
type WebSocketConnection ¶
Click to show internal directories.
Click to hide internal directories.