omnia-network / ic_websocket_example

Example backend and frontend canisters using IC WebSockets
https://demo.icws.io
MIT License
18 stars 2 forks source link

Can't find GATEWAY_PRINCIPAL value in the lib.rs file #1

Closed Darkwing4 closed 8 months ago

Darkwing4 commented 8 months ago

Can't complete final locally running step from main repo page.

image

Should i just return it, it will be work?

ilbertt commented 8 months ago

Since v0.3.1 versions of the SDKs, the gateway principal is not needed anymore in the initialization, see the changelog too.


Can't complete final locally running step from main repo page.

Can you please report here the errors that you're having?

Should i just return it, it will be work?

Can you please be more explicit on what you mean here?

Darkwing4 commented 8 months ago

Hi, @ilbertt!

I'm working on deploying a local IC Gateway and trying to integrate it with your WebSocket example. I'm curious if I need to specify the GATEWAY_PRINCIPAL of my local IC Gateway somewhere within the code. I found a reference to it in the CanisterWsOpenArguments constructor parameters. However, being new to Rust (only a couple of weeks in), I'm finding it challenging to understand exactly where and if I need to set the GATEWAY_PRINCIPAL. Could you please guide me on the necessary steps to get your example working with a local version of the IC Gateway?

Thank you for your fast assistance.

Darkwing4 commented 8 months ago

So I just can't complete this step

image

Darkwing4 commented 8 months ago

Additionally, I'm encountering an error during deployment:

~/ic_websocket_example$ dfx deploy Deploying all canisters. Error: Failed while trying to deploy canisters. Caused by: Failed while trying to deploy canisters. Failed to construct wallet canister caller: Certificate is stale (over 240s). Is the computer's clock synchronized?

Is this issue related to the GATEWAY_PRINCIPAL, or could there be another cause? Any advice on resolving this would be greatly appreciated.

Darkwing4 commented 8 months ago

sudo ntpdate time.nist.gov not work for me. I use WSL 2

ilbertt commented 8 months ago

I'm working on deploying a local IC Gateway and trying to integrate it with your WebSocket example. I'm curious if I need to specify the GATEWAY_PRINCIPAL of my local IC Gateway somewhere within the code. I found a reference to it in the CanisterWsOpenArguments constructor parameters. However, being new to Rust (only a couple of weeks in), I'm finding it challenging to understand exactly where and if I need to set the GATEWAY_PRINCIPAL. Could you please guide me on the necessary steps to get your example working with a local version of the IC Gateway?

You don't need the gateway principal anymore in your application. I've updated the README accordingly.

To run this example locally:

  1. in a separate folder and terminal, run the IC WS Gateway by cloning the ic-websocket-gateway repo and running:
    cargo run

    Have a look at the IC WebSocket Gateway's README Standalone section. If you'd rather use Docker, there's also a Docker section.

  2. in this example, comment the lines: https://github.com/omnia-network/ic_websocket_example/blob/b017614a35530687a8908c105eaf81a8228fc078/src/ic_websocket_example_frontend/src/main.ts#L12-L20 and uncomment the lines: https://github.com/omnia-network/ic_websocket_example/blob/b017614a35530687a8908c105eaf81a8228fc078/src/ic_websocket_example_frontend/src/main.ts#L22-L25
  3. start a local replica:
    dfx start --clean
  4. deploy the example canisters:
    dfx deploy
  5. open the frontend in a browser following the link printed at the end of the output of the previous command.
ilbertt commented 8 months ago

Additionally, I'm encountering an error during deployment:

~/ic_websocket_example$ dfx deploy Deploying all canisters. Error: Failed while trying to deploy canisters. Caused by: Failed while trying to deploy canisters. Failed to construct wallet canister caller: Certificate is stale (over 240s). Is the computer's clock synchronized?

Is this issue related to the GATEWAY_PRINCIPAL, or could there be another cause?

This issue doesn't seem related to the IC WebSocket protocol. Have you tried restarting the local replica and deploying the canisters with:

dfx deploy --no-wallet

instead?

Any advice on resolving this would be greatly appreciated.

The forum is usually a good place where to find technical assistance. I've briefly looked into it to find a thread with an issue similar to yours, but I didn't find anything relevant. If the error persists, I'd suggest you to open a new discussion there.

Darkwing4 commented 8 months ago
dfx start --clean
dfx deploy --no-wallet

clean start and no wallet flag fixed my problem, thx

ilbertt commented 8 months ago

Closing this issue.

@Darkwing4 feel free to re-open it or open a new one if you still have any problems.