[PB-6311]: feat/get correct user limit after purchase#1942
Conversation
Deploying drive-web with
|
| Latest commit: |
ba692f0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9847289d.drive-web.pages.dev |
| Branch Preview URL: | https://fix-fetch-user-limit-correct.drive-web.pages.dev |
| if (!this.isProduction) { | ||
| console.log('[REALTIME]: CONNECTED WITH ID', this.socket?.id); | ||
| } | ||
| console.log('[REALTIME]: CONNECTED WITH ID', this.socket?.id); |
There was a problem hiding this comment.
I suppose this is done on purpose so that it appears in the production environment, and it’s not that you’ve forgotten to put it back :)
I’m just pointing it, just in case
There was a problem hiding this comment.
Yep, so we have visibility about the socket connection.
| switch (data.event) { | ||
| case SOCKET_EVENTS.PLAN_UPDATED: | ||
| eventHandler.onPlanUpdated(data); | ||
| break; | ||
| case SOCKET_EVENTS.FILE_CREATED: | ||
| eventHandler.onFileCreated(data); | ||
| break; | ||
| } |
There was a problem hiding this comment.
I think that the before implementation was good, now for add more events we have to modify the socket service and not only the event handler :(
Maybe I'm missing something :O
There was a problem hiding this comment.
I can send the data.event directly to the eventHandler and handle there the events (using the switch). This way, we handle all in the same place, not instantiating it everywhere and using Sets...
| }); | ||
|
|
||
| this.socket.on('connect_error', (error) => { | ||
| if (error.message === 'Session ID unknown') { |
There was a problem hiding this comment.
This might be too susceptible to changes in the message. Does it return any code we can use? Although the message doesn't necessarily have to change, the code is usually less susceptible to changes than the message
There was a problem hiding this comment.
Mmm seems like socket io does not throw a code within the error. I can use includes instead (ID unknown for example).
|



Description
Refactored the Realtime service (socket connection) by simplifying its initialization: it is now set up when the app mounts and continuously listens for events.
Additionally, a temporary polling mechanism (every 5 secs during 30 secs) has been introduced after a user purchases a plan to ensure their storage is updated correctly.
Related Issues
Related Pull Requests
Checklist
Testing Process
Additional Notes