emitter

package module
v0.0.0-...-9740c68 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2017 License: MIT Imports: 4 Imported by: ? modules, 0 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

socket.io-emitter-go

Go implementation of socket.io-emitter

Install

$ go get github.com/stackcats/socket.io-emitter-go

Example

opts := &emitter.Options{}
socket := emitter.NewEmitter(opts)
defer socket.Close()
socket.Broadcast().Emit("message", "Hello World")

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

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

Emitter Socket.IO redis base emitter

func NewEmitter

func NewEmitter(opts *Options) *Emitter

NewEmitter Emitter constructor

func (*Emitter) Broadcast

func (e *Emitter) Broadcast() *Emitter

Broadcast flag

func (*Emitter) Close

func (e *Emitter) Close()

Close release redis client

func (*Emitter) Emit

func (e *Emitter) Emit(data ...interface{}) (*Emitter, error)

Emit Send the packet

func (*Emitter) In

func (e *Emitter) In(room string) *Emitter

In Limit emission to a certain `room`

func (*Emitter) JSON

func (e *Emitter) JSON() *Emitter

JSON flag

func (*Emitter) Of

func (e *Emitter) Of(namespace string) *Emitter

Of Limit emission to certain `namespace`

func (*Emitter) To

func (e *Emitter) To(room string) *Emitter

To Limit emission to a certain `room`

func (*Emitter) Volatile

func (e *Emitter) Volatile() *Emitter

Volatile flag

type Options

type Options struct {
	// host to connect to redis on (localhost)
	Host string
	// port to connect to redis on (6379)
	Port int
	// the name of the key to pub/sub events on as prefix (socket.io)
	Key string
	// unix domain socket to connect to redis on ("/tmp/redis.sock")
	Socket string
	// redis client
	Redis *redis.Client
}

Options ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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