utils

package
v0.0.0-...-5415481 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionEstablished       = "pusher:connection_established"
	Error                       = "pusher:error"
	Subscribe                   = "pusher:subscribe"
	Unsubscribe                 = "pusher:unsubscribe"
	SubscriptionSucceeded       = "pusher_internal:subscription_succeeded"
	PublicSubscriptionSucceeded = "pusher:subscription_succeeded"
	Ping                        = "pusher:ping"
	Pong                        = "pusher:pong"
	MemberAdded                 = "pusher_internal:member_added"
	MemberRemoved               = "pusher_internal:member_removed"
)

Variables

This section is empty.

Functions

func Bounded

func Bounded(a, lower, upper int) int

func Coalesce

func Coalesce(times ...sql.NullTime) sql.NullTime

func DepthFirstTraversalPrefixing

func DepthFirstTraversalPrefixing(node TreeNode)

func MaxInt

func MaxInt(a, b int) int

func MinInt

func MinInt(a, b int) int

func NullTimeFrom

func NullTimeFrom(t *time.Time) sql.NullTime

func Prefix

func Prefix(s string, prefix string) string

func PusherUrl

func PusherUrl(host string, appKey string) string

func RepositorySlugFromURL

func RepositorySlugFromURL(repositoryURL string) (string, error)

func UnmarshalPayload

func UnmarshalPayload(data []byte, v interface{}) error

Types

type ConnectionEstablishedPayload

type ConnectionEstablishedPayload struct {
	SocketId        string `json:"socket_id"`
	ActivityTimeout int    `json:"activity_timeout"`
}

type ErrorPayload

type ErrorPayload struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

type PusherClient

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

func NewPusherClient

func NewPusherClient(ctx context.Context, wsURL string, authURL string, authHeader map[string]string) (PusherClient, error)

func (*PusherClient) Authenticate

func (p *PusherClient) Authenticate(ctx context.Context, channel string) (string, error)

func (*PusherClient) Close

func (p *PusherClient) Close() error

func (*PusherClient) Expect

func (p *PusherClient) Expect(ctx context.Context, eventType string) (event PusherEvent, err error)

func (*PusherClient) NextEvent

func (p *PusherClient) NextEvent(ctx context.Context) (event PusherEvent, err error)

func (*PusherClient) Subscribe

func (p *PusherClient) Subscribe(ctx context.Context, channel string) (err error)

func (*PusherClient) Unsubscribe

func (p *PusherClient) Unsubscribe(ctx context.Context, channel string) error

type PusherEvent

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

type SubscribePayload

type SubscribePayload struct {
	Channel     string `json:"channel"`
	Auth        string `json:"auth,omitempty"`
	ChannelData string `json:"channel_data,omitempty"`
}

type TreeNode

type TreeNode interface {
	Children() []TreeNode
	Traversable() bool
	SetPrefix(prefix string) // meh. This forces us to pass a pointer to DepthFirstTraversal which is read only.
}

func DepthFirstTraversal

func DepthFirstTraversal(node TreeNode, traverseAll bool) []TreeNode

type UnsubscribePayload

type UnsubscribePayload struct {
	Channel string `json:"channel"`
}

Jump to

Keyboard shortcuts

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