> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hoplynk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Asset WebSocket

> Stream live telemetry for a specific asset — drone GPS, attitude, battery, camera motion events — over WebSocket.

## Endpoint

```
WSS https://argus.hoplynk.com/api/kits/{kit_id}/assets/{asset_id}/ws
```

## Query Parameters

| Parameter  | Type   | Default | Description                                              |
| ---------- | ------ | ------- | -------------------------------------------------------- |
| `feeds`    | string | `gps`   | Comma-separated feed names (e.g. `gps,attitude,battery`) |
| `interval` | float  | `1.0`   | Push interval in seconds. Range: `0.5`–`10.0`            |

## Auth handshake

Same first-message pattern as the [Kit WebSocket](/api-reference/streaming/kit-websocket):

```
Client → Server:  { "type": "auth", "key": "hlk_..." }
Server → Client:  { "type": "ready", "feeds": ["gps", "attitude"] }
Server → Client:  { "type": "data", "feed": "gps", "payload": {...}, "ts": "..." }
```

## Available feeds by asset type

**Drone (MAVLink)**

| Feed         | Payload fields                                                    |
| ------------ | ----------------------------------------------------------------- |
| `gps`        | `lat`, `lon`, `alt_m`, `ground_speed`, `heading`                  |
| `gps_raw`    | `lat`, `lon`, `alt_m`, `fix_type`, `satellites_visible`           |
| `attitude`   | `roll`, `pitch`, `yaw` (degrees)                                  |
| `battery`    | `voltage`, `current`, `remaining_pct`                             |
| `radio`      | `rssi`, `remote_rssi`, `noise`, `rx_errors`                       |
| `sys_status` | `armed`, `flight_mode`, `ekf_ok`                                  |
| `vfr_hud`    | `airspeed`, `groundspeed`, `throttle_pct`, `climb_mps`, `heading` |

**Camera (Reolink)**

| Feed           | Payload fields                       |
| -------------- | ------------------------------------ |
| `status`       | `online`, `motion_alarm`, `ai_alarm` |
| `motion`       | `detected`, `timestamp`              |
| `ai_detection` | `detected`, `types`, `timestamp`     |

**Camera (ONVIF)**

| Feed     | Payload fields        |
| -------- | --------------------- |
| `status` | `online`, `timestamp` |
| `motion` | `detected`            |

**Partner asset**

| Feed  | Payload fields                                                       |
| ----- | -------------------------------------------------------------------- |
| `gps` | `lat`, `lon`, `alt_m`, `bearing`, `speed_mps`, `source`, `timestamp` |

## Example

<CodeGroup>
  ```python Python theme={null}
  # Stream drone telemetry
  with client.stream(kit_id, asset_id, feeds=["gps", "attitude", "battery"]) as stream:
      for event in stream:
          feed = event["feed"]
          p = event["payload"]
          if feed == "gps":
              print(f"Pos: {p['lat']:.5f}, {p['lon']:.5f}  Alt: {p['alt_m']}m")
          elif feed == "attitude":
              print(f"Heading: {p['yaw']:.1f}°  Pitch: {p['pitch']:.1f}°")
          elif feed == "battery":
              print(f"Battery: {p['remaining_pct']}%  {p['voltage']}V")

  # Stream camera motion events
  with client.stream(kit_id, camera_id, feeds=["motion", "ai_detection"]) as stream:
      for event in stream:
          if event["feed"] == "ai_detection":
              p = event["payload"]
              if p["detected"]:
                  print(f"AI detection: {p['types']}")
  ```

  ```javascript JavaScript theme={null}
  const stream = client.stream({
    kitId,
    assetId,
    feeds: ['gps', 'attitude', 'battery'],
    interval: 0.5,
  })

  stream.on('data', ({ feed, payload }) => {
    switch (feed) {
      case 'gps':
        console.log(payload.lat, payload.lon, payload.alt_m)
        break
      case 'attitude':
        console.log(`Heading: ${payload.yaw}°`)
        break
      case 'battery':
        console.log(`Battery: ${payload.remaining_pct}%`)
        break
    }
  })

  stream.close()
  ```

  ```javascript Raw WebSocket theme={null}
  const ws = new WebSocket(
    `wss://argus.hoplynk.com/api/kits/${kitId}/assets/${assetId}/ws?feeds=gps,attitude&interval=0.5`
  )

  ws.onopen = () => ws.send(JSON.stringify({ type: 'auth', key: 'hlk_...' }))
  ws.onmessage = ({ data }) => {
    const { feed, payload } = JSON.parse(data)
    if (feed === 'gps') console.log(payload.lat, payload.lon)
  }
  ```
</CodeGroup>
