Multiple clients for a backend services (JSON-RPC)

Hi! I created a client/server (RPC) extension using the “backend” sample in the extension generator. Right now it is very basic and allows the client to set a “name” (this.client.setName('myname)). I changed the binding of the Connection to inTransientScope but my issue is that when I open in 2 browser windows, when a client sets a name, it is the same for both of them. Is there a way to have each theia instance have it’s own client connection. I really just want to be able to send an RPC message to the backend, from one instance (browser window), and have it reflect on the other [browser window] with each having separate client names.

I am building a collaborative editor and really just trying to build it correctly after doing a POC using socket.io, but would like to not maintain two different socket servers.

Any suggestions are appreciated, and thank you in advance :slight_smile:

Yes. What you need is connection based scoping. Here is a full-blown example: https://github.com/akosyakov/theia-training/tree/solution-3

The code might not be up to date, but you will get the idea. The credit goes to @akosyakov :medal_military:

2 Likes