Frontend: Build basic UI for sending and receiving messages #5
Labels
No Label
bug
Component/Client
Component/Frontend
Component/Server
duplicate
enhancement
invalid
main feature
question
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Depends on
#4 Client: Event system
binaryDiv/instantchat
#6 Frontend: Write a stub class UI
binaryDiv/instantchat
Reference: binaryDiv/instantchat#5
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
Clientclass (js/client.js) implements the communication between the web client and the server over WebSockets. It offers functions like.sendMessage()to send commands to the server, and events that can be subscribed with.on()to receive data and status information like 'connected' or 'new message' from the server. (The event system is not quite finished yet, see #4.)Now we need a user interface that interacts with this class. :)
I'll provide a
UIclass stub (js/ui.js) as an example for how to use theClientclass (subscribe to events and log to the console or something).Display messages. Messages are received by subscribing the
receiveMessageevent. The event handler gets the message content as an object (eg.{'from': 'Lexi', 'text': 'Meow meow.'}). These messages need to be displayed in some kind of chat log.Send messages. An input field for the user to write new messages. Call
client.sendMessage(text)to send the message to the server. (The server will then send the message to all users, including the one who sent it.)(Optional for now.) Initialization and other stuff. The UI should ask the user for their nickname before starting the chat, show the connection status (error if the connection is lost), and so on. But let's focus on sending and receiving messages for now! -> Another issue.
Can be started after I've finished #4 and #6. :3