Creating a gateway function that calls a javascript function

Yup, you can do this. See Embr-Periscope for inspiration:

  1. On the Perspective client-side, add your own message handler to the ClientStore's connection.
clientStore.connection.handlers.set('your-protocol', (payload) => { ... } )
  1. On the Perspective gateway-side, trigger this message by sending a message to a Page.
page.send("your-protocol", payload)
3 Likes