@JohnW12 I think I understand what you’re looking to do.
Share data/state between plugins and enable ‘shared functionality’ between them.
To accomplish this - I’d suggest looking into any of the following routes:
- All users would need to have your plugin installed/authorized and running/open in order to accomplish cross communication.
- Cross communication can happen in a few ways. You’d need to share state through:
- I’ve yet to use it, but the web-plugin API reference mentions an ‘experimental event’
- Broadcast Data:
- The method to broadcast data to all other iFrames (plugins):
broadcastData(data: any): void
// Other iframes can get this data from DATA_BROADCASTED event - ( WebPlugin Reference line 32 )
-
Data-Broadcasted event
- If data-broadcasting doesn’t work for some reason - here’s two other ideas…
- Some other server solution (think of it something like a web-socket session -- I suppose the common identifier for the connecting Miro plugin users could just be the Miro Board Id … in that … most likely there is only one session per board at any given time).
- Talk through board metadata:
- A widget object has a key value store of ‘metadata’
- Your plugin stores to that widget with ‘update’ or ‘create’
- The value is stored under your plugin’s ‘clientId’
- so any of the users using your plugin would store under that same key
- You can create an widget (or multiple) that act(s) like a global state store, storing your ‘sync’d’ data as a blob on that widget, under that metadata key.
- all the plugins could write to it.
- each plugin could write under the plugin client id and under each users Id
miro.currentUser.getId()
- This could allow then each plugin to follow the same logic in extracting/computing a global state. (synced data)
- Once state sharing is achieved, your first question, about a common interface ‘like voting’ can be achieved.
- The first way I imagine it… With one app driving the function flow and state-change specific to a given workflow (analogically: voting timer, voting options, accumulation and calculations of votes, etc).
Hopefully this is helpful. Happy Miro-developing. :)