Many of you may know this blog post which explains how to communicate between app parts (from the same provider). Unfortunately the post only describes how to communicate between "all app parts of this provider", e.g. if you have multiple tabs or even multiple browser sessions open (or are even logged in with different users) and are on the same page all app parts on all these open tabs will get notified when a change occurs.
My question is: Does anybody know a solution on how you can isolate this communication to the current-page-session the user is on? This means I only want the communication to be between app parts which are on the currently loaded site (if the site is open in another tab I don't want to communicate with the app parts there).
My issue is, that I don’t know how to recognize which AppParts are on the same page and within 'the same' page request – I would therefore need a unique page-request identifier and a way to pass this identifier to all AppParts to avoid cross-tab / -browser / -user / -session etc. communication.
I thought it may be possible via the AppManifest.xml
file by adjusting the Query string
parameters (e.g. pass a Unique-per-Page-ID) - which then would have been passed to the loading URL of the IFrames - but I could not find a parameter which helps me with this.
Has anyone any idea how to do this? Or has anyone done this?
PS: I know you can do it via PostMessages but this is not a good solution since you have to place some JavaScript directly on the parent SharePoint page (outside the app part).