---
title: Subscribing to Events
description: Learn how to subscribe to events in the Solana network.
---

Websockets provide an interface where you can listen for certain events. Instead
of pinging a HTTP endpoint at an interval to get frequent updates, you can
instead receive those updates only when they happen.

<CodeTabs storage="cookbook">

```ts !! title="Kit" file=packages/docs-examples/cookbook/development/subscribing-events/kit.ts#region=subscribe highlight=17-19

```

```ts !! title="Web3.js v3" file=packages/docs-examples/cookbook/development/subscribing-events/web3v3.ts#region=subscribe highlight=7-14

```

```rust !! title="Rust" file=packages/docs-examples/cookbook/development/subscribing-events/rust/src/main.rs#region=subscribe

```

```py !! title="Python" file=packages/docs-examples/cookbook/development/subscribing-events/python.py#region=subscribe

```

```go !! title="Go" file=packages/docs-examples/cookbook/development/subscribing-events/go/main.go#region=subscribe

```

```ts !! title="Web3.js (legacy)" file=packages/docs-examples/cookbook/development/subscribing-events/legacy.ts#region=subscribe highlight=7-14

```

</CodeTabs>
