sock

package module
v0.0.0-...-d12a2ae Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2015 License: MIT Imports: 6 Imported by: 0

README

sock

Hub of web socket connections. Borrowed from gorilla websocket chat example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is an middleman between the websocket connection and the hub.

type Hub

type Hub struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Hub maintains the set of active connections and broadcasts messages to the connections.

func NewHub

func NewHub() *Hub

NewHub creates new instance of Hub

func (*Hub) Run

func (h *Hub) Run()

Run starts the hub.

func (*Hub) Send

func (h *Hub) Send(payload interface{})

Send broadcast message to all connections

func (*Hub) ServeHTTP

func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)

Serve handles websocket requests from the peer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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