# IC WebSocket: Stable Release

**URL:** <https://forum.dfinity.org/t/ic-websocket-stable-release/23872>\
**Category:** Developers\
**Created:** [October 18, 2023, 5:23pm UTC](https://forum.dfinity.org/t/ic-websocket-stable-release/23872 "2023-10-18T17:23:10Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![ilbert](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ilbert/32/8717_2.png) [@ilbert](https://forum.dfinity.org/u/ilbert)\
**Post date:** [December 15, 2023, 10:20pm UTC](https://forum.dfinity.org/t/ic-websocket-stable-release/23872/33 "2023-12-15T22:20:37Z")

</div>

# New release!

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

## New versions

SDKs:

- Rust CDK: [v0.3.2](https://crates.io/crates/ic-websocket-cdk/0.3.2)
- JS SDK: [v0.3.2](https://www.npmjs.com/package/ic-websocket-js/v/0.3.2)
- Motoko CDK: [v0.3.2](https://mops.one/ic-websocket-cdk@0.3.2)

Gateway:

- [v1.2.2](https://github.com/omnia-network/ic-websocket-gateway/releases/tag/v1.2.2)
- Docker image: [v1.2.2](https://hub.docker.com/layers/omniadevs/ic-websocket-gateway/v1.2.2/images/sha256-d71095b4b8a745ea7eea3fb467f095fcc9c7340edd825eed48391390ee888bea)

## What’s changed

### SDKs

> We suggest you to update all your SDKs to the latest version.

- you can **close** the connection with the client _from the canister_ using the newly introduced `close` CDK method:
  - **Rust** :

```rust
ic_websocket_cdk::close(client_principal);

```

  - **Motoko** :

```javascript
await ws.close(client_principal);
// or (but doesn't call the on_close callback):
// await IcWebSocketCdk.close(ws_state, client_principal);

```

- you don’t have to specify the keep alive timeout parameter anymore (if you were doing it)
  - **Rust** : the [WsInitParams](https://docs.rs/ic-websocket-cdk/0.3.2/ic_websocket_cdk/struct.WsInitParams.html) struct doesn’t have the `keep_alive_timeout_ms` field anymore.
  - **Motoko** : WsInitParams are now initialized with one argument _less_:

```diff
- let params = IcWebSocketCdkTypes.WsInitParams(null, null, null);
+ let params = IcWebSocketCdkTypes.WsInitParams(null, null);

```

- `ws_send` is **deprecated** , use `send` instead:
  - **Rust** :

```diff
- ic_websocket_cdk::ws_send(client_principal, message_bytes);
+ ic_websocket_cdk::send(client_principal, message_bytes);

```

  - **Motoko** :

```diff
- await IcWebSocketCdk.ws_send(ws_state, client_principal, msg_bytes)
+ await IcWebSocketCdk.send(ws_state, client_principal, msg_bytes)

```

You can also follow the updated [tutorial](https://medium.com/@ilbert/websockets-on-the-ic-getting-started-5f8bcdfaabdc) for reference.

### Gateway

- fix: call `ws_close` when canister closes connection (even with an error)

---

_[View the full topic](https://forum.dfinity.org/t/ic-websocket-stable-release/23872)._
