-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement start heat request and send broadcast notification
- Loading branch information
1 parent
b65b9ca
commit 4e3f699
Showing
10 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package notification | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
) | ||
|
||
func BroadcastHeatStart(meeting string, event int, heat int, delay int) { | ||
b := ` | ||
{ | ||
"status": { | ||
"event": ` + strconv.Itoa(event) + `, | ||
"heat": ` + strconv.Itoa(heat) + `, | ||
"over": false, | ||
"delay": ` + strconv.Itoa(delay) + ` | ||
} | ||
} | ||
` | ||
notification, err := notificationClient.SendMeetingBroadcastNotification(serviceKey, meeting, b) | ||
if err != nil { | ||
fmt.Printf("failed sending meeting broadcast notification: %s", err.Error()) | ||
return | ||
} | ||
|
||
println(notification) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package notification | ||
|
||
import ( | ||
"fmt" | ||
userClient "github.com/swimresults/user-service/client" | ||
"os" | ||
) | ||
|
||
var notificationClient *userClient.NotificationClient | ||
var serviceKey string | ||
|
||
func Init() { | ||
|
||
serviceKey = os.Getenv("SR_SERVICE_KEY") | ||
|
||
if serviceKey == "" { | ||
fmt.Println("no security for inter-service communication given! Please set SR_SERVICE_KEY.") | ||
return | ||
} | ||
|
||
userServiceUrl := os.Getenv("SR_START_USER_URL") | ||
if userServiceUrl != "" { | ||
notificationClient = userClient.NewNotificationClient(userServiceUrl) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters