@@ -0,0 +1,12 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace JT808.DotNetty.Interfaces | |||||
{ | |||||
public interface IJT808Publishing | |||||
{ | |||||
Task Publish(string topicName,string key,string value); | |||||
} | |||||
} |
@@ -0,0 +1,12 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace JT808.DotNetty.Interfaces | |||||
{ | |||||
public interface IJT808SessionPublishing : IJT808Publishing | |||||
{ | |||||
} | |||||
} |
@@ -36,6 +36,7 @@ | |||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" /> | <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" /> | ||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> | <PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> | ||||
<PackageReference Include="Polly" Version="6.1.2" /> | <PackageReference Include="Polly" Version="6.1.2" /> | ||||
<PackageReference Include="StackExchange.Redis" Version="2.0.519" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -59,18 +59,17 @@ namespace JT808.DotNetty | |||||
{ | { | ||||
// 解决了设备号跟通道绑定到一起,不需要用到通道本身的SessionId | // 解决了设备号跟通道绑定到一起,不需要用到通道本身的SessionId | ||||
// 不管设备下发更改了设备终端号,只要是没有在内存中就当是新的 | // 不管设备下发更改了设备终端号,只要是没有在内存中就当是新的 | ||||
// todo: | |||||
// 存在的问题: | // 存在的问题: | ||||
// 1.原先老的如何销毁 | // 1.原先老的如何销毁 | ||||
// 2.这时候用的通道是相同的,设备终端是不同的 | // 2.这时候用的通道是相同的,设备终端是不同的 | ||||
// 当设备主动或者服务器断开以后,可以释放,这点内存忽略不计,况且更改设备号不是很频繁。 | |||||
if (SessionIdDict.TryAdd(appSession.TerminalPhoneNo, appSession)) | if (SessionIdDict.TryAdd(appSession.TerminalPhoneNo, appSession)) | ||||
{ | { | ||||
//使用场景: | //使用场景: | ||||
//部标的超长待机设备,不会像正常的设备一样一直连着,可能10几分钟连上了,然后发完就关闭连接, | //部标的超长待机设备,不会像正常的设备一样一直连着,可能10几分钟连上了,然后发完就关闭连接, | ||||
//这时候想下发数据需要知道设备什么时候上线,在这边做通知最好不过了。 | //这时候想下发数据需要知道设备什么时候上线,在这边做通知最好不过了。 | ||||
//todo: 有设备关联上来可以进行通知 | |||||
//todo: 使用Redis发布订阅 | |||||
//todo: 平台下发更改设备号的时候,这时候通道和设备号是绑定在一起的,那么要是同样的通道上来,是关联不到新的设备,需要考虑 | |||||
//todo: 有设备关联上来可以进行通知 例如:使用Redis发布订阅 | |||||
} | } | ||||
} | } | ||||