prot

package
v0.0.0-...-e1bcdf1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package prot provides protocol structures for communication between chat server and client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	Message *Message `json:"message,omitempty"` // conversation message
	Ping    *Ping    `json:"ping,omitempty"`    // ping message
	Roster  *Roster  `json:"roster,omitempty"`  // roster (list of users) message
}

Envelope is a top level communication structure. Includes all another submessages.

type Message

type Message struct {
	Ts            time.Time `json:"ts"`             // timestamp
	Name          string    `json:"name"`           // username
	Text          string    `json:"text"`           // plain text for console clients
	HTML          string    `json:"html"`           // html text for browsers
	Notification  string    `json:"notification"`   // plain notification for browsers
	Color         string    `json:"color"`          // RGB color
	ColorXterm256 string    `json:"color_xterm256"` // xterm color number suitable for \033[%sm formatting
}

Message is a conversation message

type Ping

type Ping struct {
	Timestamp time.Time `json:"ts"`   // ping timestamp
	Ping      int       `json:"ping"` // server should set incremental ping number
	Pong      int       `json:"pong"` // client should respond with the same number
}

Ping is a client ping message

type Roster

type Roster struct {
	Ts   time.Time `json:"ts"`   // timestamp
	Text string    `json:"text"` // plain text for console clients
	HTML string    `json:"html"` // html text for browsers
}

Roster is a list of online users

Jump to

Keyboard shortcuts

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