webhook type -> event

This commit is contained in:
David Zhao
2021-08-09 23:37:01 -07:00
parent 9495646f1a
commit 6fe0d4bafc
5 changed files with 12 additions and 10 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ LiveKit is an open source project that provides scalable, multi-user conferencin
- Built for production - JWT authentication and [server APIs](https://docs.livekit.io/guides/server-api)
- Robust networking & connectivity, over UDP & TCP
- Easy to deploy - pure Go & single binary
- Advanced features - speaker detection, simulcasting, selective subscription, moderation APIs.
- Advanced features - speaker detection, simulcast, selective subscription, moderation APIs, and webhooks.
## Documentation & Guides
+1 -1
View File
@@ -12,7 +12,7 @@ require (
github.com/google/wire v0.5.0
github.com/gorilla/websocket v1.4.2
github.com/jxskiss/base62 v0.0.0-20191017122030-4f11678b909b
github.com/livekit/protocol v0.7.0
github.com/livekit/protocol v0.7.1
github.com/magefile/mage v1.11.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
github.com/mitchellh/go-homedir v1.1.0
+2
View File
@@ -239,6 +239,8 @@ github.com/livekit/ion-sfu v1.20.6 h1:vA98RfuW3sSidV1rfK+/szGWgHFgki4Q4pomxsJS0i
github.com/livekit/ion-sfu v1.20.6/go.mod h1:dEdOG4KSqIftr5HxxqciNKBIdu0v3OD0ZYL7A3J09KA=
github.com/livekit/protocol v0.7.0 h1:p1HjTwlFdWalJAHs0zDFXy3Nyou0z+WqD9bernAoGT0=
github.com/livekit/protocol v0.7.0/go.mod h1:Vk04t1uIJa+U2L5SeANEmDl6ebjc9tKVi4kk3CpqW74=
github.com/livekit/protocol v0.7.1 h1:KO6n7SYrwJfnHekX0GrFY1BfC+fCXYHa5yIQ099rgsU=
github.com/livekit/protocol v0.7.1/go.mod h1:Vk04t1uIJa+U2L5SeANEmDl6ebjc9tKVi4kk3CpqW74=
github.com/lucsky/cuid v1.0.2 h1:z4XlExeoderxoPj2/dxKOyPxe9RCOu7yNq9/XWxIUMQ=
github.com/lucsky/cuid v1.0.2/go.mod h1:QaaJqckboimOmhRSJXSx/+IT+VTfxfPGSo/6mfgUfmE=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
+7 -7
View File
@@ -348,8 +348,8 @@ func (r *RoomManager) getOrCreateRoom(roomName string) (*rtc.Room, error) {
}
r.notifyEvent(&livekit.WebhookEvent{
Type: webhook.EventRoomFinished,
Room: room.Room,
Event: webhook.EventRoomFinished,
Room: room.Room,
})
// print stats
@@ -374,8 +374,8 @@ func (r *RoomManager) getOrCreateRoom(roomName string) (*rtc.Room, error) {
r.lock.Unlock()
r.notifyEvent(&livekit.WebhookEvent{
Type: webhook.EventRoomStarted,
Room: room.Room,
Event: webhook.EventRoomStarted,
Room: room.Room,
})
return room, nil
@@ -393,7 +393,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.Partici
_ = participant.Close()
r.notifyEvent(&livekit.WebhookEvent{
Type: webhook.EventParticipantLeft,
Event: webhook.EventParticipantLeft,
Room: room.Room,
Participant: participant.ToProto(),
})
@@ -401,7 +401,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.Partici
defer rtc.Recover()
r.notifyEvent(&livekit.WebhookEvent{
Type: webhook.EventParticipantJoined,
Event: webhook.EventParticipantJoined,
Room: room.Room,
Participant: participant.ToProto(),
})
@@ -580,7 +580,7 @@ func (r *RoomManager) notifyEvent(event *livekit.WebhookEvent) {
r.webhookPool.Submit(func() {
if err := r.notifier.Notify(event); err != nil {
logger.Warnw("could not notify webhook", err, "event", event.Type)
logger.Warnw("could not notify webhook", err, "event", event.Event)
}
})
}
+1 -1
View File
@@ -156,7 +156,7 @@ func (s *webookTestServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
s.lock.Lock()
s.events[event.Type] = &event
s.events[event.Event] = &event
s.lock.Unlock()
}