-
-
Notifications
You must be signed in to change notification settings - Fork 5
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 a model to the chat panel #1
Conversation
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.
Thanks for doing this @brichet !
This looks all good to me. I only have a small comment/suggestion/question concerning the method namings in the base ChatModel
src/model.ts
Outdated
* @param message - the message to send. | ||
* @returns whether the message has been sent or not, or nothing if not needed. | ||
*/ | ||
sendMessage( |
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.
Just a naming question. I'm wondering if addMessage
would be better.
In my mind, in this place we're changing the chat model to add a new message into it. Whether it is "sent" is entirely to the chatmodel implementation detail.
sendMessage( | |
addMessage( |
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.
When looking into implementing a CRDT-based chat, we'd add a message to the data structure. The sending of the changes would not be handled by the chat implementation.
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.
So I wouldn't make the base ChatModel depend on ChatService
, it seems to me ChatService
would be an implementation detail of the websocket chat implementation?
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 seems to me ChatService would be an implementation detail of the websocket chat implementation?
It is true for part of it, but some of the types/interfaces are more generics and used by the view.
I will split it, to import only the required types.
…y from an extension, and remove everything related to socket handler in the core
This PR adds a model to the chat, which must be used to implement a chat panel.
It also provides a websocket handler extending this model, as one possible implementation of the model.
The idea of this change is to be able to create a CRDT model (based on this model) in jupyter_collaboration.