# Realtime and notifications

> Set up polling, Laravel Echo, and browser alerts.

[Web documentation](https://threads.teamkrope.com/docs/realtime/) · Inner Threads v1.3.0

## Polling

Polling works with the standard Laravel HTTP routes. The default interval is 12 seconds, or the configured healthy heartbeat interval when an active realtime subscriber reports that it is connected. The healthy subscription heartbeat defaults to 45 seconds.

## Private broadcast events

Use a Laravel broadcasting driver supported by the host. Set the same guard and workspace middleware for the Inner Threads routes and `/broadcasting/auth`.

```dotenv
INNER_THREADS_REALTIME_ENABLED=true
INNER_THREADS_REALTIME_NAMESPACE=staff-platform
```

Use a namespace unique to the app if installations share broadcaster credentials and an app key. Configure `realtime.guards` for a non-default guard. Expose the initialized Echo instance as `window.Echo` before the Blade widget mounts, or pass `echoSubscribe(echo)` when you mount it yourself.

The event is `.inner-threads.changed` in Echo. It signals a change with a conversation ID and, where applicable, a message ID. Bulk deletion sends the affected IDs in `message_ids`.

## Custom subscriber

A `subscribe` function receives `{ channel, event, onSignal, onStatus }` and returns an unsubscribe function. Call `onStatus(true)` while the connection is healthy and `onStatus(false)` when it disconnects.

```js
import { echoSubscribe, mountInnerThreads } from '/vendor/inner-threads/widget.js'

mountInnerThreads(document.querySelector('#staff-chat'), {
    api: '/inner-threads/api/v1',
    subscribe: echoSubscribe(window.Echo)
})
```

## Browser notifications

Select the bell next to the expand button to opt in. The bell disappears after the browser grants permission. Open **Your profile** and use **Mute all notifications** to pause widget alerts across conversations. Unread badges still update. Set `features.browser_notifications` to `false` to disable browser alerts for the host app.

Browser alerts cover new unread messages in active, unmuted conversations while the widget is running in a background tab. Unmuting or restoring a chat does not replay alerts suppressed earlier. Archived chats can still receive messages, and their unread badges appear in **Archived**. Use **Demo** in the docs header to try the browser prompt. Chat notifications while the page is closed require a separate host push integration.
