TSMQServer.Core
0.0.23
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package TSMQServer.Core --version 0.0.23
NuGet\Install-Package TSMQServer.Core -Version 0.0.23
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TSMQServer.Core" Version="0.0.23" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TSMQServer.Core" Version="0.0.23" />
<PackageReference Include="TSMQServer.Core" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TSMQServer.Core --version 0.0.23
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TSMQServer.Core, 0.0.23"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TSMQServer.Core@0.0.23
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TSMQServer.Core&version=0.0.23
#tool nuget:?package=TSMQServer.Core&version=0.0.23
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TSMQServer.Core
TSMQServer.Core 是 TSMQ 服务端的契约层 NuGet 包,基于 TouchSocket 框架构建。
它包含所有 RPC 服务接口定义、DTO 模型以及远程调用客户端接口,供客户端项目引用,以实现强类型的远程调用(WebApi / DMTP RPC / WebSocket JsonRpc)。
安装
dotnet add package TSMQServer.Core
包含内容
RPC 服务接口(Services)
| 接口 | 说明 |
|---|---|
IUserManagerService |
用户注册、登录、查询、修改密码、删除、角色分配 |
IRoleManagerService |
角色创建、更新、删除、查询 |
IRpcAuthorizationService |
动态 RPC 方法 / 类级别角色授权管理 |
ILogManagerService |
服务端日志查询与筛选 |
IMqttServerManagerService |
MQTT 服务器实例管理(增删启停)及授权用户管理 |
IMqttClientManagerService |
已连接 MQTT 客户端查询、踢出、订阅主题查看 |
IMqttTopicManagerService |
MQTT 主题浏览与消息推送 |
远程调用客户端接口(Clients)
IRemoteService 是由源代码生成器自动生成的客户端调用接口,集成了上述全部服务方法,可直接注入使用:
// 以 DMTP 调用为例
var result = await remoteService.GetMqttServerListAsync();
数据模型(Models)
LoginedRequest— 已登录请求基类,携带 TokenResponseBase<T>— 统一响应包装ResponseCode— 响应状态码枚举MqttStatsSnapshot— MQTT 统计快照RpcMethodInfo/RpcMethodRoleInfo— RPC 方法权限信息
使用示例
1. 注册客户端服务
// 使用 DMTP 客户端
services.AddSingleton<IRemoteService>(sp =>
{
var client = new HttpDmtpClient();
client.Setup(new TouchSocketConfig()
.SetRemoteIPHost("127.0.0.1:7789")
.ConfigurePlugins(a =>
{
a.UseDmtpRpc();
}));
client.Connect();
return client.CreateDmtpRpcRemoteService<IRemoteService>();
});
2. 调用 RPC 方法
// 获取 MQTT 服务器列表
var result = await remoteService.GetMqttServerListAsync(cancellationToken);
if (result.IsSuccess)
{
foreach (var server in result.Value)
{
Console.WriteLine($"{server.ServerId} - {server.Host}:{server.Port}");
}
}
// 添加 MQTT 服务器
var addResult = await remoteService.AddMqttServerAsync(
MqttServerType.Tcp, "0.0.0.0", 1883, "/", null, cancellationToken);
依赖项
| 包 | 说明 |
|---|---|
TouchSocket.Dmtp |
DMTP RPC 支持 |
TouchSocket.WebApi |
WebApi HTTP 支持 |
TouchSocket.JsonRpc |
WebSocket JsonRpc 支持 |
相关链接
- 官方文档:https://touchsocket.net/
- GitHub:https://github.com/RRQM/TouchSocket
- 问题反馈 QQ 群:234762506
许可证
本项目遵循仓库根目录的开源许可协议。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- TouchSocket.Dmtp (>= 4.2.8)
- TouchSocket.JsonRpc (>= 4.2.8)
- TouchSocket.WebApi (>= 4.2.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.