Separating what runs on client and what runs on host when running in remote development setup

Hi

I’m developing a plugin that creates a tool window with a jcef browser.

The plugin runs an http server and passes a url to the browser to communicate with it.

When in remote development setup, I need the server to run on the remote host. the JCEF browser runs on the client, so the server port should somehow be mapped to the client.

I tried to create a small poc that implements something like that. I have a ToolWindowFactory and ToolWindowContent, which creates a jcef browser. The browser communicates with the plugin through messages back and forth (window.cefQuery).

I started experimenting with it, and ran into trouble pretty quickly.

Everything seems to work fine when running completely local, but when running in a remote development setup (WSL) the browser does not render if I invoke browser.jbCefClient.cefClient.addMessageRouter(msgRouter)

Also, as far as I can tell, almost all my code runs on the remote host. the browser obviously does not, but the ToolWindowFactory, ToolWindowContent etc also runs on the remote host, when I expected it to run on the client.

I could not find much documentation on the subject.

Here are my questions:

  1. Is there a documentation on this subject that I missed?
  2. Should the extension be installed on the host, the client, or both? I am currently installing on the host, but I am not 100% sure that was the intended design.
  3. How can I indicate which parts of the code need to run on the client and which should run on the host? In general for services, tool windows etc. and Specifically with the JCEFBrowser, there seems to be some handling of this matter, but I could not figure out how to make it work.
  4. Is there a way to control port mapping, or get info on which port on the host are mapped to which port on the client?

Any healp would be much appreciated

Amir