Compare commits
3 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
90e1134547 | |
|
|
bc2ae6d656 | |
|
|
e674e3d4df |
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
"git.min.rip/min/webpush-client-go/rfc8291"
|
||||
"git.min.rip/min/webpush-client-go/webpush"
|
||||
"github.com/shinosaki/websocket-client-go/websocket"
|
||||
"git.min.rip/min/websocket-client-go/websocket"
|
||||
)
|
||||
|
||||
const MOZILLA_PUSH_SERVICE = "wss://push.services.mozilla.com"
|
||||
|
|
@ -109,13 +109,11 @@ func NewAutoPushClient() (ap *AutoPushClient, ch chan Notification) {
|
|||
unregisterChan: make(chan UnregisterResponse),
|
||||
WebSocketClient: websocket.NewWebSocketClient(
|
||||
nil,
|
||||
func(ws *websocket.WebSocketClient, isReconnecting bool) {
|
||||
if !isReconnecting {
|
||||
func(ws *websocket.WebSocketClient) {
|
||||
close(ap.helloChan)
|
||||
close(ap.notificationChan)
|
||||
close(ap.registerChan)
|
||||
close(ap.unregisterChan)
|
||||
}
|
||||
},
|
||||
func(ws *websocket.WebSocketClient, payload []byte) {
|
||||
// log.Println("AutoPush Received Message:", string(payload))
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -3,8 +3,8 @@ module git.min.rip/min/webpush-client-go
|
|||
go 1.23.6
|
||||
|
||||
require (
|
||||
git.min.rip/min/websocket-client-go v1.1.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/shinosaki/websocket-client-go v1.0.1
|
||||
golang.org/x/crypto v0.35.0
|
||||
golang.org/x/net v0.35.0
|
||||
)
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -1,7 +1,7 @@
|
|||
git.min.rip/min/websocket-client-go v1.1.0 h1:DG0IVTE/Wp8BerYX+Vu4q6Up1VGk9zCst5nYPX9sH98=
|
||||
git.min.rip/min/websocket-client-go v1.1.0/go.mod h1:us3qS+xrO/uPnJjJOuRDuvTAmM+2cEBpiASJhT5fQao=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/shinosaki/websocket-client-go v1.0.1 h1:QMi2c7sqMWX4EWetNdoTj6rzB8BXVFRcAYlnaAncFPA=
|
||||
github.com/shinosaki/websocket-client-go v1.0.1/go.mod h1:fzgEpoLabqcgOjDVPo7dh6dTqhbCTgd3SdWO2a+fPxg=
|
||||
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
|
||||
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
|
||||
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func NewNicoPushClient(
|
|||
// Handshake performs a handshake with the AutoPush server and retrieves a UAID.
|
||||
// The obtained UAID is used for client identification and should be saved.
|
||||
func (c *NicoPushClient) Handshake() (uaid string, err error) {
|
||||
if err := c.autoPushClient.Connect(autopush.MOZILLA_PUSH_SERVICE, 3, 2, false); err != nil {
|
||||
if err := c.autoPushClient.Connect(autopush.MOZILLA_PUSH_SERVICE, 3, 2); err != nil {
|
||||
return "", fmt.Errorf("failed to connect autopush server: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue