Skip to content

subhraneel2005/trpc-realtime-notification-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High level design

Architecture Diagram 1 Architecture Diagram 2


Event flow during user signin

this is only a notifcations service, so connecting to ws server on user login

Initial event flow after user login


e2e JWT token flow

this is the e2e flow of the jwtToken from client to server, so that private function/procedures are properly authenticated through the token

e2e flow of jwt token from client to server


e2e post like and notification flow

this is the full e2e flow of what happens when user1 likes user2's post


flow1

just after user1 likes user2's post there are two websocket events that are fired (1 inbound and 2 outbounds) initial like flow

flow2

at first the inbound event (user1's client to the server) goes and does 2 tasks. one to update likes count in the db and the other is to asynchronously send the LIKE_POST event to the ws server. main e2e like flow

flow3

then the ws server constructs a NOTIFICATION_EVENT to send to the post author client and a LIKE_ACK_EVENT to send to user1 client. therefore the ws server sends 2 outbound events (server to client) outbound and inbound events diagram


payload of the inbound (LIKE_POST) event

{
  "event": "LIKE_POST",
  "userId": "user1",
  "postId": "post2"
}

payload of the outbound (NOTIFICATION) event

{
  "event": "NOTIFICATION",
  "notification": {
    "type": "LIKE",
    "liked_by": "user2",
    "post_liked_on": "post1",
    "post_author": "user1"
  }
}

feed screen wireframe

About

practicing trpc and websockets by building a realtime notification service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors