hub

package
v0.0.0-...-90507f3 Latest Latest
Warning

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

Go to latest
Published: May 17, 2014 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var H = Hub{
	Connections: make(map[domain.UserUid]*Connection),
	Register: make(chan struct {
		domain.UserUid
		*Connection
	}),
	Unregister: make(chan domain.UserUid),
}

Functions

func WsHandler

func WsHandler(w http.ResponseWriter, u domain.UserUid, r *http.Request)

Types

type Connection

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

func (*Connection) Reader

func (c *Connection) Reader()

func (*Connection) Writer

func (c *Connection) Writer()

type Hub

type Hub struct {
	Connections map[domain.UserUid]*Connection
	Register    chan struct {
		domain.UserUid
		*Connection
	}
	Unregister chan domain.UserUid
}

func (*Hub) Broadcast

func (h *Hub) Broadcast(topic string, message string)

func (*Hub) MessagePublish

func (h *Hub) MessagePublish(message *domain.Message)

func (*Hub) Run

func (h *Hub) Run()

func (*Hub) UsersOnline

func (h *Hub) UsersOnline() []domain.UserUid

Returns a list of users that are currently online

Jump to

Keyboard shortcuts

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