# Live order updates (websockets)

> Source: https://www.allsweb.com/sixpanel/docs/live-updates
> Markdown for agents: https://www.allsweb.com/sixpanel/docs/live-updates.md
> Publisher: AllsWeb (www.allsweb.com)

Part of: SixPanel documentation

**What this page is for:** turn on real-time updates — new orders appearing by
themselves, live delivery tracking — in your apps and admin panel.

**You need**

- Your main domain already working with HTTPS.
- Nothing else. No extra port is ever opened: websockets travel over port 443,
  the same port as your website.

A websocket is an open line between the app and your server, so the server can
push news to the app instead of the app asking again and again.

This is part of 6ammart, not an extra. Without it, staff only see new orders
when they reload the page. The panel turns it on for you when your project is
installed, and this page is what to do when you want to check it, move it or
turn it off.

## 1. Turn it on

1. Open **Advanced** → the **Services** tab (in the **Project** menu group).
2. Find the **Live order updates** card.
3. Turn it on.

One click does all of it: it writes the keys into your app's settings, starts
the websocket service, publishes the web-server route, and switches live
updates **on** inside the 6ammart admin panel. There is nothing to type.

The card then shows a short report, and the status rows fill in:

| Row | What it means |
|---|---|
| **Set up on this server** | the panel has written the settings |
| **Websocket server** | the service is running |
| **In the 6ammart admin panel** | the switch inside 6ammart itself is ON |
| **Apps connect to** | the address your apps will dial |

When all three are green the card says live updates are configured and switched
on.

**One thing the panel decides for you here.** 6ammart reads its websocket keys
in two different ways depending on which version of the code you have, and one
of those ways stops working when the app's settings are cached for speed. The
panel checks what your code actually does before it caches anything, so live
updates keep working on both. You never see this, and there is nothing to set —
it is here so that "it works on my copy of the code" is not something you have
to hope for.

## 2. Optional: give it its own name

By default live updates share your main domain. If you would rather use a
separate name like `ws-shop.example.com`:

1. On the **Services** tab, open the separate websocket domain section.
2. Type the name and press **Configure**.

That one job checks DNS, gets the certificate, wires the web server, updates
the app settings, restarts the websocket service and flips the matching rows
inside the 6ammart admin panel. Its log shows every step.

If Cloudflare is connected, the panel creates the DNS record itself, proxied.
Note the shape of the name: because every record is proxied and Cloudflare's
free certificate covers only one level below your domain, the panel uses
`ws-shop.example.com` rather than `ws.shop.example.com`. If you type the deeper
form it tells you the spelling that works.

## 3. If you use Cloudflare

Websockets run over port 443, which Cloudflare passes through, and the record
stays **proxied** so your server's address stays hidden.

- In Cloudflare, set the zone's SSL/TLS mode to **Full (strict)** when the
  panel got a real certificate for the websocket name — which it does whenever
  a Cloudflare token is connected.
- Use **Full**, not Full (strict), if the panel had to install a certificate the
  server signed itself. The card says which one happened and shows a chip when
  it detects Cloudflare in front.

## 4. Turning it off

Turn the same card off. The apps stop getting real-time pings, and websockets
are switched off inside the 6ammart admin panel too. You can turn them back on
at any time.

## How to check it worked

- The **Live order updates** card shows the websocket service running and **In
  the 6ammart admin panel** as ON.
- **Server → Health** shows the live-updates check in green.
- Place a test order and watch it appear in the admin panel without reloading.
- Over SSH:
  ```
  sudo sixpanel service status reverb
  ```

## If it went wrong

- **The card says the server is not running** — start it and read its log:
  ```
  sudo sixpanel service start reverb
  sudo sixpanel logs reverb -n 100
  ```
- **The row "In the 6ammart admin panel" is OFF** — turn the card on again.
  That rewrites the settings inside 6ammart.
- **Apps still do not update live** — check that your app build points at the
  same address shown in **Apps connect to**.
- **A separate websocket name has no certificate** — the DNS record is the
  usual cause. Check it with:
  ```
  sudo sixpanel ssl status ws-shop.example.com
  ```
- **You changed the websocket domain** — turn live updates on once more
  afterwards, so the apps are told the new address.

More symptoms: see [When something is broken](https://www.allsweb.com/sixpanel/docs/troubleshooting).
