-
Notifications
You must be signed in to change notification settings - Fork 6.3k
-
Hey people,
I have an instance of code-server running and it is embedded in an iframe on a page with several buttons. I am trying to figure out a way to send a message/event to my custom extension in code-server from the host page when one of the buttons is clicked.
I understand that by hacking the entrypoint file of the frontend (src/vs/code/browser/workbench/workbench.html?) I can pass a message from the host frame to the vscode iframe using postMessage, but I haven't been able to find a way to propagate it from there to my extension. microsoft/vscode#138054 looks relevant but my question still stands even if I switch to web extensions.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 4 replies
-
Hmm...seems like that PR is relevant. Besides that, I see this in the docs, but probably not directly relevant.
What is missing from the PR you posted?
Beta Was this translation helpful? Give feedback.
All reactions
-
Hi @ksdme did you find a solution to your problem? I am in the same boat and just wanted to know if you were able to find a way to do it
Beta Was this translation helpful? Give feedback.
All reactions
-
Sorry for the late response. But, I think the way I solved this at the time was by writing an extension that exposed a REST interface. The extension would basically take commands over REST and push them into vscode events handling infrastructure. I could not solve it using simple cross frame messaging.
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 4
-
Hi,
Thanks for the response!
But how would you send message from vs code to the parent iframe?
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 3
-
@ksdme Is it possible to share the extension you developed. Just want to check if it is possible to adapt in our use-case
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
I think one way to do this would be using WebSockets, or even maybe a shared DB like Firebase RealTime Database, pushing/pulling messages from there based on an identifier.
I'm going through the same thing right now and that's the way I see it for now.
Beta Was this translation helpful? Give feedback.