pham

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SSEHandler

func SSEHandler(w http.ResponseWriter, r *http.Request)

SSEHandler for gin framework route handler

func WSHandler

func WSHandler(w http.ResponseWriter, r *http.Request)

WSHandler is websocket end point

Types

type Connection

type Connection interface {
	Send(data []byte) (err error)
}

Connection interface

type ConnectionManager

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

ConnectionManager structure

func NewConnectionManager

func NewConnectionManager() (connectionManager *ConnectionManager)

NewConnectionManager is ConnectionManager constructor

func (*ConnectionManager) AddConnection

func (manager *ConnectionManager) AddConnection(conn Connection)

AddConnection add connection to connections

func (*ConnectionManager) Broadcast

func (manager *ConnectionManager) Broadcast(data JSON) (length int, err error)

Broadcast message

func (*ConnectionManager) ConnEach

func (manager *ConnectionManager) ConnEach(f func([]Connection))

ConnEach get connections safety

func (*ConnectionManager) DelConnection

func (manager *ConnectionManager) DelConnection(conn Connection)

DelConnection delete connection from connections

type JSON

type JSON map[string]interface{}

JSON is json type

type Message

type Message struct {
	Channel string
	TTL     int
	Data    JSON
}

Message is JSON structure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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