Transfer data between Figma and a standalone Mac app

I want to transfer image and some commands from Figma Plugin to a standalone Mac app.

What’s the best way to communicate between Figma and Mac app: WebSockets? FSEvents? Or is there a better way?

Thanks.