deeplink handling seems to wrong when multiple deeplinks are called at the same time

1
Hi, We use a custom plugin in Office products that calls a Mendix webservice in order to upload data and to retrieve a deeplink URL generated in our application and specific to the data uploaded. The plugin ensures a browser window is opened with the deeplinked page (signed in using SSO). This works fine. The user is nicely redirected to the deeplinked page in our application. However, recently we have extended the custom plugin in order to handle multiple operations in 1x (so plugin calls the webservice several times in a row and gets several deeplink URLs returned). The plugin performs the exact same operation (upload, receive deeplink URL, open browser window and call deeplink URL) only this time it does it several times really rapidly. Result is that several browser windows are opened (not sure whether we really would like this to happen, but this is not our issue at this moment) at the same time. However only the first window contains the actual deeplinked page. The other windows open with the regular page of the user. This is strange. When I use the debugger I noticed that the functionality is actually working properly, the debugger and the step by step process seems to allow the application to have some more time to handle the deeplink requests and it is working as we expected (so all individually opened browser windows contain the deeplinked page. If I debug only the last couple of steps (and encountering the issue) I notice that the application uses data of only 1 of the references provided by the deeplink links. As such once the first deeplinked page has been opened, the next deeplink attempts cannot be found anymore and the alternative page is opened. Summarized, the speed of calling deeplink URL's seems to confuse the application. In the case of high speed calling deeplinks, only data of 1 of the deeplinked URL's is used. Once we slow down the process by using the debugger, the functionality works properly. Did anyone else encounter this issue before? And what could be a solution to workaround this issue? Kind regards, Brian
asked
1 answers
4

Hi Brian,

I've never personally encountered this, but from the way the deeplink module works I can tell you what's going on and why this happens. The short version (for when you don't want to read this entire wall of text): The deeplink module assumes only one link will be opened at the same time per user. When you open multiple links at the same time, the links that are executed first can get overwritten by the later ones before they are completely finished. This causes the behaviour you see, where it functions correctly when debugging (slowly), but not normally.

Unfortunately, there is no easy fix using the deeplink module as it currently is, other than slowing down the rate at which links are rquested. I suggest you file a support request to make this possible in the deeplink module. If possible provide a test project, and reference this forum post to explain the issue.

Now for the full explanation:

The deeplink module handles a deeplink request roughly as follows (modified from comments in the deeplink java code):

  1. Find the requested link configuration
  2. Find the user session (based on browser cookies)
  3. If no session is found, create an anonymous session or redirect to the login page
  4. Find the user object for the session
  5. Remove any pending links for the user (they are outdated)
  6. Create a pending link object, refering to the user and the link configuration
  7. Redirect the user to index.html
  8. The Deeplink_Home microflow is executed, this retrieves the pending link and executes it
  9. The executed pending link is removed.

As you can see, the module removes any "outdated" pending deeplinks when a new link is received. This is done because the module assumes only one deeplink will be opened at the same time for a single user. In the most common cases (e.g. opening a link from an e-mail, or linking to a profile page) this is correct.

In your case, you are trying to open multiple links at the same time. When done slowly (with debugging on), this is equivalent to opening a number of links quickly, but sequentially. If it's done too fast, the java action for the next link can run before the previous link has loaded completely (into step 8).

This causes the previous pending link to be deleted (step 5). When that link gets to step 8, it loads the pending link created for the next link, because that is the only one present for the user. Then the pending link is removed (step 9), so when the next link gets to step 8, it has no pending link anymore and will display the default home screen instead.

I hope this sheds some light on the issue.

answered