tranx

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(wsConn *websocket.Conn) *protocol.TranxClient

NewClient returns a new client struct.

Types

type IDs

type IDs struct{ *sync.Map }

IDs is a threadsafe set of numbers.

func (*IDs) Bind

func (ids *IDs) Bind() int

Bind binds an id to connection.

func (*IDs) DeleteID

func (ids *IDs) DeleteID(id int)

DeleteID Deletes a bound ID.

type Mailbox

type Mailbox struct {
	Sender               *protocol.TranxSender
	Receiver             *protocol.TranxReceiver
	CommunicationChannel chan []byte
	Quit                 chan bool
}

Mailbox is a data structure that links together a sender and a receiver client.

type Mailboxes

type Mailboxes struct{ *sync.Map }

func (*Mailboxes) DeleteMailbox

func (mailboxes *Mailboxes) DeleteMailbox(p string)

DeleteMailbox deallocates a mailbox.

func (*Mailboxes) GetMailbox

func (mailboxes *Mailboxes) GetMailbox(p string) (*Mailbox, error)

GetMailbox returns the decired mailbox.

func (*Mailboxes) StoreMailbox

func (mailboxes *Mailboxes) StoreMailbox(p string, m *Mailbox)

StoreMailbox allocates a mailbox.

type Server

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

Server is contains the necessary data to run the tranx server.

func NewServer

func NewServer(port int) *Server

NewServer constructs a new Server struct and setups the routes.

func (*Server) Start

func (s *Server) Start()

Start runs the tranx server.

Jump to

Keyboard shortcuts

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