web

package
v1.10.14-RELEASE-3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: MIT Imports: 12 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.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Browsers = [...]Browser{
	{"Chrome", *regexp.MustCompile("https://(android|fcm).googleapis.com/(gcm|fcm)/send/"), *regexp.MustCompile("<TITLE>(.*)</TITLE>")},
	{"Firefox", *regexp.MustCompile("https://updates.push.services.mozilla.com/wpush"), *regexp.MustCompile("\\\"errno\\\":\\s(\\d+)")},
}

Browsers available

Functions

This section is empty.

Types

type Browser

type Browser struct {
	Name     string
	ReDetect regexp.Regexp
	ReError  regexp.Regexp
}

Browser type

type Client

type Client struct {
	HTTPClient *http.Client
}

Client type

func NewClient

func NewClient() *Client

NewClient returns a new web.Client

func (*Client) Push

func (c *Client) Push(n *Notification, apiKey string) (*Response, error)

Push sends a notification using Webpush

type Notification

type Notification struct {
	Subscription *Subscription           `json:"subscription,omitempty"`
	Payload      *map[string]interface{} `json:"payload,omitempty"`
	TimeToLive   *uint                   `json:"time_to_live,omitempty"`
}

Notification type

type Response

type Response struct {
	StatusCode int
	Body       string
}

Response type

type Subscription

type Subscription struct {
	Endpoint string `json:"endpoint,omitempty"`
	Key      string `json:"key,omitempty"`
	Auth     string `json:"auth,omitempty"`
}

Subscription type

Jump to

Keyboard shortcuts

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