push

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package push adapts the long-lived FCM connection to Ring's account-scoped API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegistrationTransport

func NewRegistrationTransport(next http.RoundTripper) http.RoundTripper

NewRegistrationTransport validates every outbound FCM HTTP route and applies the known registration compatibility transformations before forwarding it.

func Start

func Start(ctx context.Context, saved json.RawMessage) (<-chan Event, error)

Start opens one FCM receiver. Credentials are caller-owned and can be persisted between runs; the receiver itself owns no Ring account state.

func StartWithHTTPTransport added in v0.5.0

func StartWithHTTPTransport(
	ctx context.Context,
	saved json.RawMessage,
	transport http.RoundTripper,
) (<-chan Event, error)

StartWithHTTPTransport opens one FCM receiver using the supplied HTTP transport. A nil transport uses the standard HTTP transport.

func StartWithTransports added in v0.5.0

func StartWithTransports(
	ctx context.Context,
	saved json.RawMessage,
	transport http.RoundTripper,
	dialContext DialContextFunc,
) (<-chan Event, error)

StartWithTransports opens the FCM receiver with injectable HTTP and MCS transports. The dial context function must return a connection ready for MCS frames; nil uses the receiver's TLS dialer.

Types

type DialContextFunc added in v0.5.0

type DialContextFunc func(context.Context, string, string) (net.Conn, error)

type Event

type Event struct {
	Kind        Kind
	Token       string
	Credentials json.RawMessage
	Data        json.RawMessage
	Err         error
}

func TranslateEvent

func TranslateEvent(raw pushreceiver.Event) (Event, bool)

TranslateEvent maps third-party receiver events into this package's event shape.

type Kind

type Kind string
const (
	KindCredentials Kind = "credentials"
	KindConnected   Kind = "connected"
	KindMessage     Kind = "message"
	KindRetry       Kind = "retry"
	KindClosed      Kind = "closed"
)

Jump to

Keyboard shortcuts

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