-
Notifications
You must be signed in to change notification settings - Fork 187
Add dedicated chat API #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dedicated chat API #1224
Conversation
🦋 Changeset detectedLatest commit: 6a7a15f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, some non-blocker questions
@@ -519,6 +520,9 @@ export enum ParticipantEvent { | |||
* fired on local participant only, when the first remote participant has subscribed to the track specified in the payload | |||
*/ | |||
LocalTrackSubscribed = 'localTrackSubscribed', | |||
|
|||
/** only emitted on local participant */ | |||
ChatMessage = 'chatMessage', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe should be called ChatMessageReceived? Might also clear up some confusion to split it into ChatMessageReceived and ChatMessageSent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was trying to avoid having two different events for sent
and received
because it generally generates more boilerplate when having to listen to two different events. The second argument that lead me to try to combine the events under one name was that when differentiating between sent
and received
we'd also have to consider a different event for updated
.
I'm not sure though it's the right call to combine them. Considering the reasoning above, what's your opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see - I was confused.
Maybe the ParticipantEvent one should be called localChatMessageSent
, since that's all its used for and it would then align perfectly with its handler, onLocalChatMessageSent
.
The RoomEvent one stay as chatMessage
but you should add a comment explaining that its emitted for chat messages sent, received, and updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that sounds like a good idea!
@@ -519,6 +520,9 @@ export enum ParticipantEvent { | |||
* fired on local participant only, when the first remote participant has subscribed to the track specified in the payload | |||
*/ | |||
LocalTrackSubscribed = 'localTrackSubscribed', | |||
|
|||
/** only emitted on local participant */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this comment right? it looks like it's emitted on room, with participant in the args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's defined both on RoomEvents and ParticipantEvents. This comment is for the ParticipantEvent.ChatMessage
, so it's correct here.
depends on livekit/protocol#785
worth discussing:
should the client-sdk-js already hold an array of all incoming chat messages or is that left to components and/or user land?