# WebSocket Integration

This guide walks you through how to create and deploy a **custom WebSocket server** that works seamlessly with Stellar. This feature allows **external monitoring servers** to push real time product data directly into the bot, giving Stellar users faster and more customized alerts.

It’s perfect for **cook groups, monitor providers or developers** who want to power Stellar’s WebSocket tab with their own monitoring.

<figure><img src="/files/4w8011YlGpwj09gqjpeD" alt=""><figcaption></figcaption></figure>

***

### What is Stellar’s WebSocket Feature?

Stellar users can now connect to **external WebSocket servers** via a dedicated field in the Settings tab. These servers act just like Stellar’s in house server side monitor, providing fast and reliable product pings for supported modules.

This gives you the power to:

* Run your own monitors and deliver custom product pings to users
* Monetize or enhance your group offerings with Stellar compatible support
* Push lightning fast restock info from your own backends into Stellar tasks

***

### How Does It Work?

When you add your WebSocket server in your bot settings, Stellar connects to your endpoint (`ws://` or `wss://`) and begins listening for product restock pings in real time.

Your server should:

* Accept connections from authenticated Stellar users
* Broadcast product pings to all connected users in **Stellar’s accepted format**
* Optionally restrict or track key usage (for private servers)

<figure><img src="/files/H1fQmle5zrKRRB9OmlS8" alt=""><figcaption></figcaption></figure>

***

### How Do I Build a Compatible WebSocket Server?

You can use **any backend language or framework** as long as it:

* Accepts WebSocket traffic (port 80 for `ws://`, or 443 for `wss://` via reverse proxy like NGINX)
* Sends properly formatted **stringified JSON payloads**
* Authenticates users by API key (via query string)

We recommend building with **Node.js**, **Python**, **Go**, or **Rust** for ease of development and scale but any language that supports WebSocket libraries will work.

***

### Websocket Format

#### Amazon Format

**Required for Amazon connections:**

* `region`, `sku`, and `offerId` are **required**
* `productImage` must be a **valid URL**
* `productPrice` must be a **string**
* Supported Regions:\
  `['USA', 'CA', 'UK', 'NL', 'FR', 'IT', 'DE', 'JP', 'ES', 'BE', 'PL', 'AU']`

```
{
  "site": "amazon",
  "region": "USA",
  "sku": "B09MQ5L5N9",
  "offerId": "OID",
  "details": {
    "productTitle": "Amazon Test",
    "productImage": "https://www.image.com/",
    "productPrice": "199.99"
  }
}
```

#### All Other Sites

* `sku` is always **required**
* `offerId` is only used for **Walmart USA/CA**
* `productImage` must be a **valid URL**
* `productPrice` must be a **string**

```
{
  "site": "exactly like in task creator",
  "sku": "SKU required",
  "offerId": "only Walmart USA/CA",
  "details": {
    "productTitle": "Example Product",
    "productImage": "https://www.image.com/",
    "productPrice": "199.99"
  }
}
```

{% hint style="warning" %}
Due to the number of supported sites, not all have been individually tested. We strongly recommend testing your WebSocket with an in stock item and if detection doesn’t work, open a ticket and we'll tag the dev team.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guides.stellaraio.com/stellar/developing-software-compatible-with-stellar/websocket-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
