::: tip
Version 2.0 update: the MQTT, TCP, and UDP servers based on the Netty architecture have been integrated, with sessions and devices of the three servers managed uniformly.
:::

## 1. Configuration File

Let's look at how to start and stop services in the configuration file. Each service is controlled by `enabled`, and MQTT and WebSocket are started and stopped together.<br> <img alt="Configuration file screenshot" src="../../../../business/v2/dev/images/server/server01.png" style="border:1px solid #ccc;border-radius:6px;" loading="lazy" />

In the backend code, the server management modules are as follows:<br> <img alt="Configuration file screenshot" src="../../../../business/v2/dev/images/server/server02.png" style="border:1px solid #ccc;border-radius:6px;" loading="lazy" /> <img alt="Configuration file screenshot" src="../../../../business/v2/dev/images/server/server03.png" style="border:1px solid #ccc;border-radius:6px;" loading="lazy" />

1. boot-strap         manages the startup of each server
2. iot-server-core    builds the TCP service and UDP service, and is also the basic core module integrating all servers, containing sessions, basic decoding/encoding, basic configuration, and other information
3. mqtt-broker        the MQTT broker and WebSocket service built on Netty

## 2. Unified Configuration Class and Session Management

Integrated base configuration class: <span dir="">NettyConfig</span>

Session management: <span dir="">ISessionStore</span>

## 3. MQTT & WebSocket Service Startup Class

MQTTBootStrap<br> <img alt="MQTT & WebSocket service startup class screenshot" src="../../../../business/v2/dev/images/server/server04.png" style="border:1px solid #ccc;border-radius:6px;" loading="lazy" />

## 4. TCP Service Startup Class

TCPBootStrap<br> <img alt="TCP service startup class screenshot" src="../../../../business/v2/dev/images/server/server05.png" style="border:1px solid #ccc;border-radius:6px;" loading="lazy" />

## 5. UDP Service Startup Class

UDPBootStrap<br> <img alt="UDP service startup class screenshot" src="../../../../business/v2/dev/images/server/server06.png" style="border:1px solid #ccc;border-radius:6px;" loading="lazy" />

## 6. Locating Server Code for Secondary Development

| Requirement | Check First | Description |
| --- | --- | --- |
| MQTT/TCP/UDP start/stop | Server configuration, BootStrap | Confirm the `enabled` flag and port configuration |
| Device session management | `ISessionStore` | Unified management of connection state and sessions |
| Protocol parsing | `fastbee-protocol` | It is not recommended to write protocol parsing in a Controller |
| Device authentication | `/iot/tool/mqtt/auth` and other APIs | Authentication logic must keep the product, device, and auth code consistent |
| Video signaling | `sip-server`, `isup-server` | Troubleshoot SIP/ISUP separately from the media playback chain |
| Recording service | `fastbee-record` | ZLM Hook, recording, playback |

For more module mappings, see [Backend Module Mapping](https://www.fastbee.cn/doc/en/business/v2/dev/backend-module-map.html).
