Skip to content

Commit

Permalink
Replace 'sendMessage' by 'addMessage' for genericity
Browse files Browse the repository at this point in the history
  • Loading branch information
brichet committed Mar 4, 2024
1 parent cb6c945 commit ba2c3e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function ChatBody({
setInput('');

// send message to backend
chatModel.sendMessage({ body: input });
chatModel.addMessage({ body: input });
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/websocket-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class WebSocketHandler extends ChatModel {
* Sends a message across the WebSocket. Promise resolves to the message ID
* when the server sends the same message back, acknowledging receipt.
*/
sendMessage(message: ChatService.ChatRequest): Promise<boolean> {
addMessage(message: ChatService.ChatRequest): Promise<boolean> {
message.id = UUID.uuid4();
return new Promise(resolve => {
this._socket?.send(JSON.stringify(message));
Expand Down
4 changes: 2 additions & 2 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface IChatModel extends IDisposable {
* @param message - the message to send.
* @returns whether the message has been sent or not, or nothing if not needed.
*/
sendMessage(
addMessage(
message: ChatService.ChatRequest
): Promise<boolean | void> | boolean | void;

Expand Down Expand Up @@ -125,7 +125,7 @@ export class ChatModel implements IChatModel {
* @param message - the message to send.
* @returns whether the message has been sent or not.
*/
sendMessage(
addMessage(
message: ChatService.ChatRequest
): Promise<boolean | void> | boolean | void {}

Expand Down

0 comments on commit ba2c3e5

Please sign in to comment.