gowebpusher

package module
v0.0.0-...-8ff511f Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

README

GOWebPusher - Push notifications for the web browsers using Golang

GoWebPusher

GoDoc codecov Build Status

Push notifications for the web browsers using Golang

⚠️ Library still under active development

Features

  • Send push notifications to web browsers

Supported browsers

Browser Supported version Endpoint
Chrome ✓ 60+ https://fcm.googleapis.com/fcm/send/{subId}
Edge ✓ 17+ https://par02p.notify.windows.com/w/?token={subId}
Firefox ✓ 55+ https://updates.push.services.mozilla.com/wpush/v2/{subId}
Vivaldi ✓ 17+ https://fcm.googleapis.com/fcm/send/{subId}
Opera ✓ 76+ https://fcm.googleapis.com/fcm/send/{subId}
Yandex ✓ 21+ https://fcm.googleapis.com/fcm/send/{subId}
Safari Safari supports a custom implementation .
WWDC video by apple

Usage

package main

func main() {

}

Speed

..

Documentation

You can view detailed documentation here: GoDoc.

Contributing

There are many ways to contribute:

Changelog

View the changelog for the latest updates and changes by version.

License

Apache License 2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Overview

Package gowebpusher helps sending push notifications to web browsers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateVAPID

func GenerateVAPID() (vapidPrivateKey string, vapidPublicKey string, err error)

GenerateVAPID will generate public and private VAPID keys using ECDH protocl

Types

type PushSubscription

type PushSubscription struct {
	Endpoint string
	Key      PushSubscriptionKey
}

PushSubscription interface of the Push API provides a subscription's URL endpoint.

type PushSubscriptionKey

type PushSubscriptionKey struct {
	P256dh string
	Auth   string
}

PushSubscriptionKey represents a client public key, which can then be sent to a server and used in encrypting push message data. P256dh: 🔒 Receiver public key (‘p256dh’): The p256dh key received as part of the Subscription data. Auth: 🔑 Auth key (‘auth’): Auth key The auth key received as part of the Subscription data.

type Sender

type Sender struct {
	PushSubscriptions []PushSubscription
	VAPIDPublicKey    string
	VAPIDPrivateKey   string
}

Sender instance

func NewSender

func NewSender() *Sender

NewSender will initialize an instance of sender

func (*Sender) Initialize

func (s *Sender) Initialize()

Initialize will set the default values of the sender instance

func (*Sender) Send

func (s *Sender) Send() int

Send will deliver the notification to all subscriptions

type VAPIDKeys

type VAPIDKeys struct {
	Public  string
	Private string
}

VAPIDKeys contains the public and private VAPID keys

Jump to

Keyboard shortcuts

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