chat

package
v0.0.0-...-1b5478c Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MESSAGE_CHAT = "chat"
View Source
const MESSAGE_LEAVE = "leave"
View Source
const MESSAGE_LOG = "log"
View Source
const MESSAGE_NEW_LOGIN = "new_login"

Variables

This section is empty.

Functions

func GetRooms

func GetRooms() map[string][]*WebSocketConnection

func HandleRooms

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

func HandleWS

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

Types

type M

type M map[string]interface{}

type Rooms

type Rooms struct {
	Name   string `json:"name"`
	Status string `json:"status"`
}

type SocketPayload

type SocketPayload struct {
	From    string `json:"from"`
	Message string `json:"message"`
	Room    string `json:"room"`
	To      string `json:"to"`
	Type    string `json:"type"`
}

type SocketResponse

type SocketResponse struct {
	User    string `json:"user"`
	From    string `json:"from"`
	Type    string `json:"type"`
	Message string `json:"message"`
	Room    string `json:"room"`
	To      string `json:"to"`
}

type WebSocketConnection

type WebSocketConnection struct {
	*websocket.Conn
	Username string
}

Jump to

Keyboard shortcuts

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