pass client info object in participant joined request (#358)

* pass client info object in participant joined request

Signed-off-by: shishir gowda <shishir@livekit.io>

* Update tests

Signed-off-by: shishir gowda <shishir@livekit.io>
This commit is contained in:
shishirng
2022-01-20 15:29:34 -05:00
committed by GitHub
parent 4e4ad102f7
commit 829e183863
4 changed files with 18 additions and 23 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ require (
github.com/google/wire v0.5.0
github.com/gorilla/websocket v1.4.2
github.com/hashicorp/golang-lru v0.5.4
github.com/livekit/protocol v0.11.11-0.20220113222200-a4208afda1fd
github.com/livekit/protocol v0.11.11-0.20220120192814-bde53c19d1bd
github.com/magefile/mage v1.11.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
github.com/mitchellh/go-homedir v1.1.0
+2 -2
View File
@@ -132,8 +132,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY/mKrcvA=
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
github.com/livekit/protocol v0.11.11-0.20220113222200-a4208afda1fd h1:62EgUkw1tQyqgie8o03/56f6ZSW5i6o3bApYPYFCK5c=
github.com/livekit/protocol v0.11.11-0.20220113222200-a4208afda1fd/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
github.com/livekit/protocol v0.11.11-0.20220120192814-bde53c19d1bd h1:FUaZaJafv7ljzw4R9eMpwjrGVo1aSuTswmvP8trNegA=
github.com/livekit/protocol v0.11.11-0.20220120192814-bde53c19d1bd/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls=
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
@@ -57,19 +57,13 @@ func (t *telemetryServiceInternal) ParticipantJoined(ctx context.Context, room *
})
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
Type: livekit.AnalyticsEventType_PARTICIPANT_JOINED,
Timestamp: timestamppb.Now(),
RoomId: room.Sid,
ParticipantId: participant.Sid,
Participant: participant,
Room: room,
SdkType: clientInfo.GetSdk(),
ClientVersion: clientInfo.GetVersion(),
ClientOs: clientInfo.GetOs(),
ClientOsVersion: clientInfo.GetOsVersion(),
ClientDeviceModel: clientInfo.GetDeviceModel(),
ClientBrowser: clientInfo.GetBrowser(),
ClientBrowserVersion: clientInfo.GetBrowserVersion(),
Type: livekit.AnalyticsEventType_PARTICIPANT_JOINED,
Timestamp: timestamppb.Now(),
RoomId: room.Sid,
ParticipantId: participant.Sid,
Participant: participant,
Room: room,
ClientInfo: clientInfo,
})
}
@@ -36,13 +36,14 @@ func Test_OnParticipantJoin_EventIsSent(t *testing.T) {
require.Equal(t, participantInfo, event.Participant)
require.Equal(t, room.Sid, event.RoomId)
require.Equal(t, room, event.Room)
require.Equal(t, clientInfo.Sdk, event.SdkType)
require.Equal(t, clientInfo.Version, event.ClientVersion)
require.Equal(t, clientInfo.Os, event.ClientOs)
require.Equal(t, clientInfo.OsVersion, event.ClientOsVersion)
require.Equal(t, clientInfo.DeviceModel, event.ClientDeviceModel)
require.Equal(t, clientInfo.Browser, event.ClientBrowser)
require.Equal(t, clientInfo.BrowserVersion, event.ClientBrowserVersion)
require.Equal(t, clientInfo.Sdk, event.ClientInfo.Sdk)
require.Equal(t, clientInfo.Version, event.ClientInfo.Version)
require.Equal(t, clientInfo.Os, event.ClientInfo.Os)
require.Equal(t, clientInfo.OsVersion, event.ClientInfo.OsVersion)
require.Equal(t, clientInfo.DeviceModel, event.ClientInfo.DeviceModel)
require.Equal(t, clientInfo.Browser, event.ClientInfo.Browser)
require.Equal(t, clientInfo.BrowserVersion, event.ClientInfo.BrowserVersion)
}
func Test_OnParticipantLeft_EventIsSent(t *testing.T) {