mirror of
https://github.com/statbate/special-pancake.git
synced 2026-08-11 03:12:42 +00:00
fix leave
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
d9e6c4edbc
commit
b17b989e28
1 changed files with 9 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ func main() {
|
||||||
c, err := ably.NewRealtime(
|
c, err := ably.NewRealtime(
|
||||||
ably.WithAutoConnect(true),
|
ably.WithAutoConnect(true),
|
||||||
ably.WithToken(authToken),
|
ably.WithToken(authToken),
|
||||||
// ably.WithLogLevel(ably.LogDebug),
|
ably.WithLogLevel(ably.LogDebug),
|
||||||
ably.WithAuthMethod(http.MethodGet),
|
ably.WithAuthMethod(http.MethodGet),
|
||||||
ably.WithUseTokenAuth(true),
|
ably.WithUseTokenAuth(true),
|
||||||
ably.WithRealtimeHost("realtime.pa.highwebmedia.com"),
|
ably.WithRealtimeHost("realtime.pa.highwebmedia.com"),
|
||||||
|
|
@ -42,7 +42,9 @@ func main() {
|
||||||
|
|
||||||
type leaveMsg struct {
|
type leaveMsg struct {
|
||||||
Action string `json:"action"`
|
Action string `json:"action"`
|
||||||
|
User struct {
|
||||||
IsBroadcaster bool `json:"is_broadcaster"`
|
IsBroadcaster bool `json:"is_broadcaster"`
|
||||||
|
} `json:"user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
tipChannel := "room:tip_alert:" + room_uid
|
tipChannel := "room:tip_alert:" + room_uid
|
||||||
|
|
@ -57,7 +59,10 @@ func main() {
|
||||||
cancel()
|
cancel()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if leave.Action == "leave" && leave.IsBroadcaster {
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
if leave.Action == "leave" && leave.User.IsBroadcaster {
|
||||||
fmt.Println("user finished and exit")
|
fmt.Println("user finished and exit")
|
||||||
cancel()
|
cancel()
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue