Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beetlex-io/mqtt
high performance .NET library for MQTT based communication support v3.x and v5.0 protocols
https://github.com/beetlex-io/mqtt
csharp iot mqtt mqtt-client mqtt-protocol mqtt-server net netcore tcp tls websocket
Last synced: 9 days ago
JSON representation
high performance .NET library for MQTT based communication support v3.x and v5.0 protocols
- Host: GitHub
- URL: https://github.com/beetlex-io/mqtt
- Owner: beetlex-io
- License: apache-2.0
- Created: 2022-11-11T01:06:46.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-10T03:45:00.000Z (6 months ago)
- Last Synced: 2024-10-11T14:09:28.176Z (26 days ago)
- Topics: csharp, iot, mqtt, mqtt-client, mqtt-protocol, mqtt-server, net, netcore, tcp, tls, websocket
- Language: C#
- Homepage:
- Size: 406 KB
- Stars: 14
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MQTT
#### 介绍
基于BeetleX组件扩展的高性能MQTT通讯网关,可以轻松应对数十万的消费订阅转发.组件实现了3.x和5.0版本的协议。
#### 运行服务
``` csharp
class Program
{
private static MQTTServer mServer;
static void Main(string[] args)
{mServer = new MQTTServer(ProtocolType.V3);
mServer.RegisterComponent();
mServer.MQTTListen(o =>
{
o.DefaultListen.Port = 8089;//mqtt服务端口
})
.Setting(o =>
{
o.LogToConsole = true;
o.Port = 80;//web管理端口
o.LogLevel = EventArgs.LogType.Info;
})
.UseJWT()
.UseEFCore()
.UseElement(PageStyle.ElementDashboard)
.Initialize((http, vue, resoure) =>
{
resoure.AddAssemblies(typeof(BeetleX.MQTT.Server.MQTTUser).Assembly);
resoure.AddCss("website.css");
resoure.AddScript("echarts.js");
vue.Debug();
})
.Run();}
}
```
运行成功后可以通过浏览器访问 http://localhost 进入管理界面(如果电脑上已经有服务占用了80端口,则根据自己需要调整)。
### 单独使用协议包
BeetleX.MQTT.Protocols是MQTT的协议分析组件,它是基于Stream来处理MQTT协议,如果不想使用BeetleX配套网服务功能可以单独引用BeetleX.MQTT.Protocols来进行MQTT的协议分析.组件是支持V3.X和V5.0
``` csharp
//v5
var mqttparse = new BeetleX.MQTT.Protocols.V5.MQTTParseV5();
mqttparse.Read(stream, null);
mqttparse.Write(msg, stream, null);
//v3.x
var mqttparse = new BeetleX.MQTT.MQTTParseV3();
mqttparse.Read(stream, null);
mqttparse.Write(msg, stream, null);
```
### 主界面
![image](https://github.com/beetlex-io/mqtt/assets/2564178/b962273c-0ea9-4651-b577-4a49fd3fe38c)### 帐号界面
![image](https://github.com/beetlex-io/mqtt/assets/2564178/96abc308-5a86-46bc-92da-085bb7278531)### 设备查看界面
![image](https://github.com/beetlex-io/mqtt/assets/2564178/302aeccf-0d69-4a00-92a0-a0137b83b871)