chatsrv

package
v0.0.0-...-a0c15bd Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

README

  1. Basic HTML: we use jet a library
  2. We use 3 external tools:
    1. routing: bmizerany/pat
    2. template engine: CloudyKit
    3. websocket: gorilla websocket
  3. renderPage renders a jet template, creates pages.
    1. We use 3 arguments: w (http.ResponseWriter), tmpl (string), data (jet.VarMap) <- can be empty

  1. Somebody connects to the webpage: func Home <- display the webpage
  2. func WsEndpoint is called to connect the WS
  3. When we connect to WS:
    1. go ListenForWs(&conn) <- is called
    2. go ListenForWs(&conn) <- is a goroutine on a infite loop
    3. wsChan <- payload <- everything sent on the payload is pass to wsChan
  4. func ListenToWsChannel() <- everything on the the payload is store on the variable e
    1. Here is where we process the payload, the logic, where we stract the username or the message.
  5. func broadcastToAll <- send the payload to all the clients

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChatService

func ChatService(wg *sync.WaitGroup)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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