pusher

package
v0.0.0-...-ac8a552 Latest Latest
Warning

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

Go to latest
Published: May 30, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IN_CHANNEL_SIZE  = 100
	OUT_CHANNEL_SIZE = 10
)
View Source
const (
	MAX_RECONNECT_WAIT = time.Second * 30
)

Variables

View Source
var DefaultPusher = &Pusher{
	Client:          "pusher-websocket-go",
	Version:         "0.5",
	Protocol:        7,
	ConnectTimeout:  time.Second * 30,
	ActivityTimeout: time.Second * 120,
	PingTimeout:     time.Second * 30,
}

Functions

This section is empty.

Types

type Channel

type Channel struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Channel) Bind

func (c *Channel) Bind(event string, h Handler)

func (*Channel) BindAll

func (c *Channel) BindAll(h Handler)

func (*Channel) BindAllFunc

func (c *Channel) BindAllFunc(h func(Event))

func (*Channel) BindFunc

func (c *Channel) BindFunc(event string, h func(Event))

func (*Channel) Unbind

func (c *Channel) Unbind(event string, h Handler)

func (*Channel) UnbindAll

func (c *Channel) UnbindAll(h Handler)

func (*Channel) UnbindAllFunc

func (c *Channel) UnbindAllFunc(h func(Event))

func (*Channel) UnbindFunc

func (c *Channel) UnbindFunc(event string, h func(Event))

type Channels

type Channels struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type Client

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

func NewClient

func NewClient(appKey string) *Client

func NewClientUrl

func NewClientUrl(url string) (*Client, error)

func (*Client) Bind

func (c *Client) Bind(event string, h Handler)

func (*Client) BindAll

func (c *Client) BindAll(h Handler)

func (*Client) BindAllFunc

func (c *Client) BindAllFunc(h func(Event))

func (*Client) BindFunc

func (c *Client) BindFunc(event string, h func(Event))

func (*Client) Close

func (c *Client) Close()

Close client and don't reconnect.

func (*Client) Subscribe

func (c *Client) Subscribe(channel string) *Channel

func (*Client) Unbind

func (c *Client) Unbind(event string, h Handler)

func (*Client) UnbindAll

func (c *Client) UnbindAll(h Handler)

func (*Client) UnbindAllFunc

func (c *Client) UnbindAllFunc(h func(Event))

func (*Client) UnbindFunc

func (c *Client) UnbindFunc(event string, h func(Event))

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(channel string)

type Event

type Event struct {
	Event   string `json:"event,omitempty"`
	Channel string `json:"channel,omitempty"`
	Data    string `json:"data,omitempty"`
}

type Handler

type Handler interface {
	HandleEvent(Event)
}

type HandlerFunc

type HandlerFunc func(Event)

func (HandlerFunc) HandleEvent

func (f HandlerFunc) HandleEvent(e Event)

type Pusher

type Pusher struct {
	Client          string
	Version         string
	Protocol        int
	ConnectTimeout  time.Duration
	ActivityTimeout time.Duration
	PingTimeout     time.Duration
}

func (*Pusher) NewClient

func (p *Pusher) NewClient(appKey string) *Client

func (*Pusher) NewClientUrl

func (p *Pusher) NewClientUrl(pusherUrl string) (*Client, error)

type TimeoutReason

type TimeoutReason int
const (
	NoTimeout TimeoutReason = iota
	ConnectTimeout
	ActivityTimeout
	PingTimeout
)

type TimeoutTimer

type TimeoutTimer struct {
	C      <-chan time.Time
	Reason TimeoutReason
	// contains filtered or unexported fields
}

func (*TimeoutTimer) Expired

func (t *TimeoutTimer) Expired() bool

func (*TimeoutTimer) Reset

func (t *TimeoutTimer) Reset()

func (*TimeoutTimer) SetTimeout

func (t *TimeoutTimer) SetTimeout(reason TimeoutReason, d time.Duration)

func (*TimeoutTimer) Stop

func (t *TimeoutTimer) Stop()

Jump to

Keyboard shortcuts

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