-
Notifications
You must be signed in to change notification settings - Fork 0
/
push.go
42 lines (33 loc) · 1012 Bytes
/
push.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//********************************************************************************************************************//
//
// Copyright (C) 2018 - 2021 J&J Ideenschmiede GmbH <info@jj-ideenschmiede.de>
//
// This file is part of goerecht24.
// All code may be used. Feel free and maybe code something better.
//
// Author: Jonas Kwiedor (aka gowizzard)
//
//********************************************************************************************************************//
package goerecht24
import (
"fmt"
)
// SendPushNotification is to send a push notification to all registered clients
func SendPushNotification(document string, r Request) error {
// Set config for new request
c := Config{fmt.Sprintf("/push/%s", document), "POST", nil}
// Send request
response, err := c.Send(r)
if err != nil {
return err
}
// Close request
defer response.Body.Close()
// Check response status
err = statusCodes(response.Status)
if err != nil {
return err
}
// Return nothing
return nil
}