IC WebSocket: Stable Release

New release, breaking changes!

Today we’re releasing new IC WebSocket versions that affect both the SDKs and the gateway.

:warning: With this release, the gateway hosted at gateway.icws.io will become incompatible with all clients running old SDKs versions! Please upgrade the SDKs!

New versions

SDKs:

Gateway:

What’s changed

The CDKs now support multiple gateways! This means that you can now specify an array of gateway principals in the CDK initialization, and those will be the gateways authorized to interact with the canister.

For the Gateway, we’ve updated the IC WebSocket protocol to meet the latest requirements and we’ve added the tracing telemetry! We’re planning make a Jaeger UI dashboard publicly available.

Actions required

  1. in JS, if you have any @dfinity/... dependency, make sure you upgrade/downgrade them to v0.20.1
  2. upgrade both JS and canister libraries to the latest versions
    In case you can’t upgrade the @dfinity/... dependencies, installing the latest ic-websocket-js version using npm install ic-websocket-js@0.3.0 --force should work as a temporary fix.
  3. if you’re using Rust in your canister, change the initialization of the WsInitParams to:
    - let params = WsInitParams::new(handlers, gateway_principal);
    + let params = WsInitParams::new(handlers, vec![gateway_principal]);
    
    and eventually include other gateways’ principals in the array.
  4. if you’re using Motoko in your canister, change the IcWebSocketState initialization to:
    - var ws_state = IcWebSocketCdk.IcWebSocketState(gateway_principal);
    + var ws_state = IcWebSocketCdk.IcWebSocketState([gateway_principal]);
    
    and eventually include other gateways’ principals in the array.

That’s all you have to do!

You can also follow the updated tutorial for reference.

Motivation

Following our Proposal: Enable canisters to pay in ICP for external services, we are moving towards a more decentralized deployment of the gateways.
We’re now experimenting with Flux and we’ve already deployed some instances of the WS Gateway there. We will follow up with instructions on how to use those gateways as well.

The hosted gateway at gateway.icws.io will remain available.

6 Likes