Wait for backend to frontend event to complete

Hi all,

In my custom extension, an event is fired from the backend to the frontend. This has been done by implementing JsonRpcServer-derived implementation on the backend side. Front end subscribes to the event by calling the method setClient of the backend server. This works fine !

In the backend, when I call the event, I would like the backend to WAIT till the handler in the frontend completes it’s execution. Can we achieve this in theia? any examples, please…

You should be able to await on JSON RPC request to a client.

thank you, @akosyakov.

Is it like calling like below when we need to fire an event:
await this.client.onSomethingChanged(args) ?

It should be a request, not a notification. You cannot await on notifications, i.e. it should not start with on or notify and should return a promise.

thank you, @akosyakov. I shall try that and get back to you.