server

package
v0.0.0-...-4a967fc Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2018 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HallID              = "Hall"
	MaxChatClientBuffer = 12
	MaxPastMessage      = 25
)
View Source
const (
	MaxMessageBuffer = 36
)
View Source
const (
	MaxNewConnections = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

type Chat

type Chat struct {
	Id string

	HistMessage *datastructure.CSlice

	Name    string
	Server  *Server
	Clients map[string]*Client

	BroadcastMessage chan Message
	EnterChat        chan *Client
	LeaveChat        chan *Client
}

type Client

type Client struct {
	Id   string
	Name string
	Code string

	Conn        *websocket.Conn
	Server      *Server
	CurrentChat *Chat

	Chats        map[string]*Chat
	ChangeChatId string
	ChangeChat   chan int

	SendMessage  chan Message
	CloseChannel chan int
}

type Message

type Message struct {
	Id   string    `json:"id"`
	Code string    `json:"code"`
	Name string    `json:"name"`
	Msg  string    `json:"msg"`
	Date time.Time `json:"date"`
}

type Server

type Server struct {
	Id      string
	Clients map[string]*Client
	Chats   map[string]*Chat
	Hall    *Chat

	NewConnections chan *websocket.Conn
	ChangeChat     chan *Client
	Exit           chan int
}

func CreateServer

func CreateServer() *Server

func (*Server) HandleNewConnection

func (server *Server) HandleNewConnection(conn *websocket.Conn)

Jump to

Keyboard shortcuts

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