Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version string = "0.1.0"
Version - Used to identify specific versions of the CloudLink Golang server.
var WebsocketUpgrader = websocket.Upgrader{ ReadBufferSize: 2048, WriteBufferSize: 2048, CheckOrigin: func(r *http.Request) bool { return true }, }
WebsocketUpgrader is used to upgrade HTTP(s) requests into websocket connections.
Functions ¶
func MulticastMessage ¶
func MulticastMessage(clients ClientList, message schemas.CloudlinkRootSchema)
MulticastMessage will send a message to multiple clients.
func ServeWS ¶
func ServeWS(host string)
ServeWS starts the CloudLink server in insecure (ws://) mode. You must call initServer beforehand to use this function.
func ServeWSS ¶
ServeWSS starts the CloudLink server in secure (wss://) mode. You must have a certificate file (cert, or cert.pem) and a private key (key, or key.pem) file present and trusted by your client(s) before running.
You must call initServer beforehand to use this function.
func UnicastMessage ¶
func UnicastMessage(client Client, message schemas.CloudlinkRootSchema)
UnicastMessage will send a message to a single client.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a websocket client.
func (*Client) MessageHandler ¶
Main function for handling websocket messages.
type ClientList ¶
ClientList is a map used to keep track of clients.
type Manager ¶
type Manager struct { // Used to lock states before editing a client. sync.RWMutex // contains filtered or unexported fields }
Manager is used to store all values for each client.
func NewManager ¶
func NewManager() *Manager
NewManager is used to create a manager struct and initialize its values.
func (*Manager) RemoveClient ¶
RemoveClient removes a client from the ClientList and cleans things up