Here's a puzzling question that may not have a straightforward solution, but I'm willing to give it a try. Recently, I developed a brilliant one-page application where each open tab "registers" itself with the server upon startup, indicating its status as an "active" tab.
Now, whenever user A makes changes to XYZ in the workspace, all tabs within that workspace receive a notification informing them of the update. This triggers a reload for all clients, ensuring they are promptly updated. Currently, this is achieved through polling, but once everything is running smoothly, I plan to implement faster solutions like WS or Socket.io.
The issue at hand: every tab receives the notification, even the one that initiated the change! (resulting in unnecessary updates for an already refreshed screen)
I need a way for the server to identify the specific tab that triggered the request. Keep in mind, a user could have multiple tabs open simultaneously, so when they modify XYZ, all tabs should be notified except for the one responsible for the original change.
Currently, I include the workspace ID in every Ajax request since a user might be logged in with access to various workspaces simultaneously.
- Solution 1: Include both the workspace ID and tab ID in each request
- Solution 2: Utilize only the tab ID for requests, allowing the app to determine the workspace ID based on the tabID
- Solution 3: ???? Any suggestions?
Any innovative ideas to tackle this challenge?