Skip to content

London | 26-SDC-July | Raihan Sharif | Sprint 2 | Chat-app - #124

Open
RaihanSharif wants to merge 53 commits into
CodeYourFuture:mainfrom
RaihanSharif:main
Open

RaihanSharif wants to merge 53 commits into
CodeYourFuture:mainfrom
RaihanSharif:main

Conversation

@RaihanSharif

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1162

Changelist

Created a live updating chat app that allows client to use either long polling or short polling.

  • Users can add new message

  • User is notified whenever a new message is created by another user

  • User can like or dislike a message

  • User is notified when a message is liked/disliked

backend: https://z4k2yzxetkpevkwf6zy9ea37.trainees.hosting.cyf.academy/messages
frontend: https://qhdyqohwxffxraktvwh1e0ys.trainees.hosting.cyf.academy/

@RaihanSharif RaihanSharif added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 22, 2026
Only return list of messages, or a single message.

Clean up js doc
Messages can now be fetched or created using REST API.

Client can then fetch subsequent messages using event streaming.
create new message handling function.
@RaihanSharif

Copy link
Copy Markdown
Author

Update: I have now created the two separate apps, one polling and one Websocket. Both try to reuse as much code as possible, both in the frontend and backend.

Backend:

  • pollingApp.js
  • websocketApp.js
  • All other files are common between the two, such as the model, helper functions etc.

Frontend:

  • pollingScript.js
  • websocketScript.js
  • common.js -- contains the common files between the two.

Application uses HTTP post to create new messages and reactions and event streaming through either long polling or websocket to read new events.

Has some functionality to avoid race conditions by using even cursor per client.

@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Oct 7, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 7, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work building this app, you've organised the files neatly and used classes where appropriate. I can also see places where you've given consideration to how you could extend with new functionality later.

I have spotted a few areas where you could improve, or where you could answer my questions to check your understanding of the code.

Comment thread .vscode/settings.json Outdated
Comment thread chat-app/frontend/common.js
Comment thread chat-app/backend/Message.js
Comment thread chat-app/backend/EventStream.js
/**
* Sends new events for each waiting request, if there are any events to send.
*/
notifyWaiters() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between a "waiter" and a "subscriber"?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this code waiters are the polling requests, and subscribers are WebSocket connections.

I was going to create a more general "subscriber" interface so that both WebSocket and HTTP, but I didn't have the time to get it done.

I've added some comments to make this clearer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Adding comments is a good way to reduce ambiguity, thanks for adding them. If you encounter this again, another approach could be to change the variable names themselves to make the distinction more clear

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Oct 7, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@RaihanSharif RaihanSharif added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 9, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 9, 2026
@RaihanSharif RaihanSharif added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 9, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 9, 2026
@RaihanSharif RaihanSharif added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 15, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 15, 2026
@RaihanSharif RaihanSharif added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 15, 2026
@LonMcGregor LonMcGregor added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 16, 2026
@LonMcGregor

Copy link
Copy Markdown
Contributor

Thanks for answering my questions, this is complete now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants