Websocket connection with canister

I get this error on the mainnet when trying to communicate with websockets on my canister;

Refused to connect to ‘wss://gateway.icws.io/’ because it violates the following Content Security Policy directive: “connect-src ‘self’ https://icp0.io https://*.icp0.io https://icp-api.io”.

Adding wss://gateway.icws.io/ to the Content Security Policy configuration in the .ic-assets.json5 file and deployed but got the same error.

reinstallation of the frontend canister actually fixed the error.

Maybe reinstalling updates it from the root.

Basically, upgrading the canister after the changes didnt work until I reinstalled the frontend canister

1 Like

This should work since dfx 0.14.0. Are you by any chance able to reproduce and/or even provide a reproducible example?

I think i should be able to, I guess if i should remove this “wss://gateway.icws.io/” from the CSP configuration, i should be able to reproduce the error.

I might have to reinstall the frontend canister though.

To me though, I think the fact that the .ic-assets.json5 doesn’t update upon upgrade on the IC should be checked.

We do have a test for this situation. I’m wondering what the difference could be

2 Likes

Wow, its suppose to update on upgrade then.

Lemme try to recreate the issue, maybe i missed something.
I will get back to you on it.

1 Like

Is websockets currently down??

Error: Connection is not established yet