[
“””
let’s migrate to websocket.
first take stock of our current routes in server/boardRoutes.ts. Currently we have 9 routes including /images, /stats and the file uploader.
Let’s keep the file uploads using REST but migrate the images real-time sync routes.
Create two new files: a list of routes and the socket loader.
Copy the eligible board routes to our new socket routes list. Import and use it in our socket loader.
Setup the routes to be simple easy to change. Setup the socket loader to be DRY SRP and modular.
Confirm the routes are correct then clean-up the boardRoutes.ts.
Finally add the new socket loader script to server.ts.
Let’s try to keep the code impact minimal while improving the code quality while we work.
“””,
“””
great proceed.
“””,
“””
ok double check your work, clean it up and let’s finalize the server side websocket handlers.
“””,
“””
Now that the server side is ready, let’s refactor the client side to use the new websocket endpoints.
Create dedicated client side websocket handler script and let’s use it in our apiService.ts and imageService.ts.
Only migrate routes setup in the server/ socket routes list.
Check the boardService.ts logic matches.
At this point we should be fully migrated to the websocket system
“””,
“””
great proceed.
“””,
“””
double check your work on the client side.
“””,
“””
Let’s review the new websocket system end to end. Confirm the client payload and server responses all match.
Confirm the client-side is optimal and correct.
Confirm the server side is optimal and correct.
“””,
“””
Yes proceed final fixes
“””,
“””
Great let’s do final production ready review of our new websocket real-time data sync.
“””,
“””
do you reccomend any improvements.
“””
]
Leave a Reply