MeshCentral
MeshCentral copied to clipboard
Unable to connect websocket on Iframe
Remote desktop embedding on iframe shows "Unable to connect to WebSocket -- reconnect". But the same URL on iframe src is working perfectly on the browser.
Iframe screen
Can you open your browser's console and show any errors?
Also, did you put:
"allowframing": true
In the settings section of your config.json?
@Ylianst i believe the user did #4461
Can you open your browser's console and show any errors?
Also, did you put:
"allowframing": true
In the settings section of your config.json?
Yes i did

@Ylianst i believe the user did #4461
This issue was raised by me. And the current issue is not with the iframe. The URL loaded in the iframe shows an error like WebSocket couldn't connect.
@Ylianst @si458 , Is there a fix for this problem? A 404 error is returned by the commander.ashx while trying to embed in an iframe. However, there is no problem when using the same url directly in the browser.
@rajatheynetech ...you're trying to connect to 127.0.0.1
instead of the dns name, so you're going to have SSL negotiation problems.
SSL requires the right names in the certs in the browser.
No, it is connecting to htpps://domain.com/commander.ashx
What is commander.ashx ? What are you expecting? Never heard of that before.
On mine all I get is a connect button, and a disconnected message. It's a status 304...which makes me think invalid resource.
Commander was the old v1 version of Mesh I believe, before the websockets rewrite.
Like I mentioned above the problem is only for remote connecting through embedding into an iframe. Embedding is done through by following only meshcentral's user guide. No issue when the same url directly applied into the browser.
I understand you're trying to use an iframe and embed it in your app. This is your user guide's instructions right?
https://ylianst.github.io/MeshCentral/meshcentral/#embedding-meshcentral
I see no references to any "commander.ashx" What is that? I only see commander.htm in MeshCentral's source code: https://github.com/Ylianst/MeshCentral/blob/master/public/commander.htm
Your error is also about FLoC (which is dead and being removed from chrome), so you must be in a special dev mode to even see that error. https://www.drupal.org/project/drupal/issues/3284706
Your problem is probably completely unrelated to the error you posted.
Maybe you can glean something from Tactical RMM's source on how to integrate MeshCentral via iframe...working well there:
https://github.com/amidaware/tacticalrmm https://github.com/amidaware/tacticalrmm-web
@Ylianst @rajatheynetech did you get resolution of this error while running MeshCentral in Iframe?
@Ylianst @rajatheynetech did you get resolution of this error while running MeshCentral in Iframe?
No. Still not work for iframe. but we have not tried the latest solutions which mentioned above.
@silversword411 I am facing the same issue in iframe when I am trying to connect to MeshCentral URL with login token .Without login token it is working fine it is displaying login page of meshcentral
Remote desktop embedding on iframe shows "Unable to connect to WebSocket -- reconnect". But the same URL on iframe src is working perfectly on the browser.
Iframe screen
I encountered the same problem and finally found that the error was caused by cross-site request. I solved this problem by setting the "sessionSameSite": "None" configuration item in config.json. Refer to the following issue: Meshcentral not loading in iFrame in Chrome or Edge | Missing SameSite Attribute on Cookie #4211.