Skip to content

✨Feat: refetch events after Gcal Notification#126

Merged
tyler-dane merged 39 commits into
mainfrom
feat/43-init-websockets
Sep 29, 2024
Merged

✨Feat: refetch events after Gcal Notification#126
tyler-dane merged 39 commits into
mainfrom
feat/43-init-websockets

Conversation

@tyler-dane
Copy link
Copy Markdown
Contributor

@tyler-dane tyler-dane commented Sep 8, 2024

Adds opt-in** WebSocket integration between client and server via socket-io library

Summary

  • Emits notification to client after receiving a webhook from Google
  • Client handles notification by fetching weekly events
  • Includes a route to debug functionality locally
    • Run this from a separate terminal while the server is running: curl -X POST http://localhost:3000/api/event-change-demo

Visual Summary

websocket-flow
^ click image to expand

Usage

**To opt-in to this feature, add this to your .env, replacing the example value with your userid:

# .env
DEMO_SOCKET_USER=your-mongodb-userid 

Also includes the following changes that aren't directly related to WebSockets 🙈

  • refactors client authentication
  • refactors tests to use a mock logger
  • refactors express server initialization
  • adds a date utility: isEventInRange
  • adds a sync redux slice, moving some state there that was previously in settings
  • enables typechecking for test files

Related Issue: #43

@tyler-dane tyler-dane linked an issue Sep 8, 2024 that may be closed by this pull request
7 tasks
@tyler-dane tyler-dane changed the title ✨feat(backend): init websockets ✨feat: init websockets Sep 9, 2024
@tyler-dane tyler-dane self-assigned this Sep 12, 2024
Comment thread packages/backend/src/sync/controllers/sync.debug.controller.ts Fixed
@tyler-dane tyler-dane force-pushed the feat/43-init-websockets branch 9 times, most recently from 452fc31 to f9eeece Compare September 22, 2024 12:58
@tyler-dane tyler-dane changed the title ✨feat: init websockets ✨Feat: create connection between client <> server via websockets Sep 26, 2024
@tyler-dane tyler-dane changed the title ✨Feat: create connection between client <> server via websockets ✨Feat: create connection to client via websockets Sep 26, 2024
.warning doesn't actually exist on winston.logger 😅
this enables accessing the userId lower in the component tree, like in the socket provider
restrict nulls in attempt to prevent websocket connection with 'null' id
refactor(web): separate view and sync state
poc(wip): re-render after event  change dispatched
fix(web): prevent refresh when clicking tooltip wrapper
chore(web): remove timeout from useRefresh
this, in combination with using the spinner, ensures that userId is
always a string and not null
@tyler-dane tyler-dane force-pushed the feat/43-init-websockets branch from ac63fd7 to 316ca31 Compare September 28, 2024 20:35
@tyler-dane tyler-dane force-pushed the feat/43-init-websockets branch from bee0889 to 49040eb Compare September 28, 2024 22:08
@tyler-dane tyler-dane changed the title ✨Feat: create connection to client via websockets ✨Feat: refetch events after Gcal Notification Sep 29, 2024
@tyler-dane tyler-dane marked this pull request as ready for review September 29, 2024 02:46
@tyler-dane tyler-dane force-pushed the feat/43-init-websockets branch from 42f5eb7 to aee3b86 Compare September 29, 2024 02:56
@tyler-dane tyler-dane merged commit 6dabbb7 into main Sep 29, 2024
@tyler-dane tyler-dane deleted the feat/43-init-websockets branch September 29, 2024 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Update Client After GCal Event Notification via WebSockets

2 participants