> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name:

siteRealtime.unsubscribe(options: UnsubscribeOptions)

# Method Link:

https://dev.wix.com/docs/sdk/frontend-modules/site-realtime/unsubscribe.md

# Method Description:

Unsubscribes from a channel or channel resource.

The `unsubscribe()` function unsubscribes from receiving messages published
 on the specified channel or channel resource.

 + Use the `channel` property of the `UnsubscribeOptions` object
   passed to the `options` parameter to unsubscribe from all subscriptions to a
   specific channel or channel resource.

   When you unsubscribe from a channel you do not unsubscribe from the
   resources on that same channel. To no longer receive messages on a
   channel resource, you must explicitly unsubscribe from the specific resource.

 + Use the `subscriptionId` property of the `UnsubscribeOptions` object
   passed to the `options` parameter to unsubscribe from a specific subscription.

   This option is typically used when you have more than one subscription to the same
   channel or channel resource and you only want to unsubscribe from one of those subscriptions.

   Get a subscription's `subscriptionId` from the resolution of the Promise returned
   when creating the subscription with the [`subscribe()`](#subscribe) function.

# Method Permissions:



# Method Permissions Scopes IDs:

undefined



# Method Code Examples:

## Unsubscribe from all subscriptions to a channel

```javascript
import { realtime } from '@wix/site-realtime';

// ...

const someChannel = {"name": "someChannel"};
let subscriptionId1;
let subscriptionId2;

// first subscription to a channel 
realtime.subscribe(someChannel, messageHandler1)
  .then( (id) => {
    subscriptionId1 = id;
  }) ;

// second subscription to the same channel
realtime.subscribe(someChannel, messageHandler2)
  .then( (id) => {
    subscriptionId2 = id;
  }) ;

// ...

realtime.unsubscribe({"channel": someChannel})
  .then( () => {
    // unsubscribed from all subscriptions to channel
  } );

// ...

function messageHandler1(message, channel){
  // handle channel messages
}

function messageHandler2(message, channel){
  // handle channel messages
}
```

## Unsubscribe from a specific subscription to a channel

```javascript
import { realtime } from '@wix/site-realtime';

// ...

const someChannel = {"name": "someChannel"};
let subscriptionId1;
let subscriptionId2;

// first subscription to a channel 
realtime.subscribe(someChannel, messageHandler1)
  .then( (id) => {
    subscriptionId1 = id;
  }) ;

// second subscription to the same channel
realtime.subscribe(someChannel, messageHandler2)
  .then( (id) => {
    subscriptionId2 = id;
  }) ;

// ...

realtime.unsubscribe({"subscriptionId": subscriptionId1})
  .then( () => {
    // unsubscribed from first subscription to channel
  } );

// ...

function messageHandler1(message, channel){
  // handle channel messages
}

function messageHandler2(message, channel){
  // handle channel messages
}
```