comm

package
v0.0.0-...-1174e2e Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendToSocket

func SendToSocket(msg *messages.Action) (err error)

SendToSocket will send an action message to socket message

func StartServer

func StartServer(rootd string, datad string, actions chan<- *messages.Action)

StartServer starts in a goroutine both webserver and websocket handlers

func StartSocketListener

func StartSocketListener(actions chan<- *messages.Action, shutdown <-chan interface{}, forcecreation bool, wg *sync.WaitGroup)

StartSocketListener executes a socket listener in its own goroutine

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a ws connection

func NewClient

func NewClient(ws *websocket.Conn, server *WSServer) (*Client, error)

NewClient creates a new ws client

func (*Client) Done

func (c *Client) Done()

Done close down client connection

func (*Client) Listen

func (c *Client) Listen()

Listen Write and Read request via channel

func (*Client) Send

func (c *Client) Send(msg *messages.WSMessage)

Send a message to a client

type WSServer

type WSServer struct {
	// contains filtered or unexported fields
}

WSServer maintaining the web socket server

var WSserv *WSServer

WSserv main ws client connections

func NewWSServer

func NewWSServer(patternURL string, actions chan<- *messages.Action) *WSServer

NewWSServer create a new ws server

func (*WSServer) Del

func (s *WSServer) Del(c *Client)

Del removes a client from the connected list

func (*WSServer) Done

func (s *WSServer) Done()

Done signal we are shutting down the ws server

func (*WSServer) Err

func (s *WSServer) Err(err error)

Err signals about client errors

func (*WSServer) Listen

func (s *WSServer) Listen()

Listen to new ws client conn

func (*WSServer) NewAction

func (s *WSServer) NewAction(actionmsg *messages.Action)

NewAction is an action received by one client, sent to the main system process

func (*WSServer) SendAllClients

func (s *WSServer) SendAllClients(msg *messages.WSMessage)

SendAllClients signal a new message to send to all clients

Jump to

Keyboard shortcuts

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