1234567891011121314151617181920212223242526272829303132333435363738 |
- using Blue;
- using UnityEngine;
- /// <summary>
- /// https://www.emqx.io/docs/zh/v5.1/faq/faq.html#emqx-%E5%90%AF%E5%8A%A8%E6%97%B6%E6%8F%90%E7%A4%BA%E7%AB%AF%E5%8F%A3%E8%A2%AB%E5%8D%A0%E7%94%A8-eaddrinuse-%E5%BA%94%E8%AF%A5%E6%80%8E%E4%B9%88%E5%8A%9E
- /// 1883 MQTT 协议端口
- /// 8883 MQTT/SSL 端口
- /// 8083 MQTT/WebSocket 端口
- /// 8084 MQTT/WSS (WebSocket/SSL) 端口,可通过配置修改
- /// 4370 用于 EMQX 分布式集群远程函数调用、Mnesia 数据同步等
- /// 5370 用于分担上一端口压力的集群 RPC 端口,主要用于节点间转发 MQTT 消息
- /// 18083 HTTP API 服务的默认监听端口,Dashboard 功能也依赖于这个端口,可通过配置修改
- /// </summary>
- public class BlueMQTT : AbstractController
- {
- [SerializeField] private string brokerAddress = "api-fat1.ghz-tech.com";
- [SerializeField] private int brokerPort = 1883;
- [SerializeField] private string mqttUserName = "u@unity3";
- private IMQTTService mQTTService;
- void Start()
- {
- mQTTService = this.GetService<IMQTTService>();
- mQTTService.brokerAddress = brokerAddress;
- mQTTService.brokerPort = brokerPort;
- mQTTService.mqttUserName = mqttUserName;
- }
- void Update()
- {
- mQTTService.Update();
- }
- private void OnApplicationQuit()
- {
- mQTTService.OnApplicationQuit();
- }
- }
|