diff --git a/src/components/chat.tsx b/src/components/chat.tsx index eaaac71..ae148ac 100644 --- a/src/components/chat.tsx +++ b/src/components/chat.tsx @@ -75,7 +75,7 @@ function ChatBody({ setInput(''); // send message to backend - chatModel.sendMessage({ body: input }); + chatModel.addMessage({ body: input }); }; return ( diff --git a/src/handlers/websocket-handler.ts b/src/handlers/websocket-handler.ts index 0cc0403..aedba8c 100644 --- a/src/handlers/websocket-handler.ts +++ b/src/handlers/websocket-handler.ts @@ -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 { + addMessage(message: ChatService.ChatRequest): Promise { message.id = UUID.uuid4(); return new Promise(resolve => { this._socket?.send(JSON.stringify(message)); diff --git a/src/model.ts b/src/model.ts index 3a1aaa4..0a9abf7 100644 --- a/src/model.ts +++ b/src/model.ts @@ -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; @@ -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 {}