comms

package module
v0.0.0-...-3e7d295 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: MIT Imports: 8 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

communication

Standard Communication Channels

Documentation

Index

Constants

View Source
const (
	WriteDeadline = 10 * time.Second
	ReadDeadline  = WriteDeadline
	PongWait      = 60 * time.Second
	PingPeriod    = (PongWait * 9) / 10
	MessageSize   = 4096
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	Id       *uuid.UUID
	Reciever chan interface{}
}

type InstancePool

type InstancePool map[uuid.UUID]*Instance

type Message

type Message struct {
	Success  chan bool
	Reciever *uuid.UUID
	Data     interface{}
}

type Messenger

type Messenger struct {
	Register     chan *Instance
	Unregister   chan *Instance
	UnregisterId chan *uuid.UUID
	Message      chan *Message
	// contains filtered or unexported fields
}

func NewMessenger

func NewMessenger() *Messenger

func (*Messenger) MakeInstance

func (m *Messenger) MakeInstance(rec chan interface{}) *Instance

func (*Messenger) SendMessage

func (m *Messenger) SendMessage(to *uuid.UUID, mes interface{}) bool

func (*Messenger) Start

func (m *Messenger) Start()

type Socket

type Socket interface {
	Reader() chan (interface{})
	Writer() chan (interface{})
	Start(read interface{})
	Close()
}

func AcceptSocket

func AcceptSocket(w http.ResponseWriter, r *http.Request) (Socket, error)

func EstablishSocket

func EstablishSocket(dialurl string) (Socket, error)

func NewSocket

func NewSocket(conn *websocket.Conn) Socket

Jump to

Keyboard shortcuts

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