PostMessage API

Hello Community,

I’m want to integrate the viewer, which is running as a extra service, into my own SolidJs web application, so far binding it with an iframe works.

My problem:
I’ve read in the documentation that I can cors communicate with the viewer by using the window.postMessage() method. But what are my API endpoints? I can’t find those in the documentation, there is just a hint for the communication itself but no example for doing a request though. Can someone give me an explanation or even a list of possible API endpoints?
Or the class where they are defined in the source code?

Maybe I do get something wrong and have to implement those myself?

Best regards!

Hello @sinht and welcome to the community.

In short, there are no API endpoints per se. However, depending on the context where the postMessage handler is added, the handler could have access the various managers and services that are available in OHIF. For example, if the postMessage handler were to be added in an extension’s preRegistration method, the handler would have access to what I mentioned.

I hope this helps.

1 Like

Actually, it looks like some of the managers are available at the window - services, ExtensionManager and CommandsManager.

1 Like

Thank you for your reply and help, im trying to implement my window message listener as a new extension,
or module, not sure yet which of those are the correct place for that, im still trying to understand the code archetacture.
It feels like i am Indianer Jones in a Dungeon.