{"id":19699239,"url":"https://github.com/smallchi/jt808gateway","last_synced_at":"2026-02-13T16:16:21.386Z","repository":{"id":40504856,"uuid":"153229833","full_name":"SmallChi/JT808Gateway","owner":"SmallChi","description":"JT/T808 Gateway,JT808 Gateway, GB808 Gateway(support 2011, 2013, 2019 version) JT/T808网关、JT808网关、GB808网关(支持2011、2013、2019版本)","archived":false,"fork":false,"pushed_at":"2024-01-13T08:54:26.000Z","size":9245,"stargazers_count":180,"open_issues_count":0,"forks_count":117,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-04-28T07:13:12.519Z","etag":null,"topics":["808","808-tcp","808-udp","csharp","dotnetcore","gb808","gps","gps-gateway","jt808","jt808-dotnetty","jt808-gateway","jt808-pipeline","net6","tracker"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmallChi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-16T05:53:21.000Z","updated_at":"2024-06-04T03:45:36.567Z","dependencies_parsed_at":"2024-01-13T11:10:38.203Z","dependency_job_id":"786cd9f0-c314-4b64-b6bf-8435a93a9ad0","html_url":"https://github.com/SmallChi/JT808Gateway","commit_stats":{"total_commits":134,"total_committers":4,"mean_commits":33.5,"dds":"0.11194029850746268","last_synced_commit":"bcb8bffb3c1c73c5453283b53cbef59693805aca"},"previous_names":["smallchi/jt808dotnetty"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmallChi%2FJT808Gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmallChi%2FJT808Gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmallChi%2FJT808Gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmallChi%2FJT808Gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmallChi","download_url":"https://codeload.github.com/SmallChi/JT808Gateway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248564847,"owners_count":21125412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["808","808-tcp","808-udp","csharp","dotnetcore","gb808","gps","gps-gateway","jt808","jt808-dotnetty","jt808-gateway","jt808-pipeline","net6","tracker"],"created_at":"2024-11-11T20:01:55.010Z","updated_at":"2026-02-13T16:16:21.369Z","avatar_url":"https://github.com/SmallChi.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JT808Gateway\n\n支持TCP/UDP通用消息业务处理\n\n[![MIT Licence](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE)![.NET Core](https://github.com/SmallChi/JT808Gateway/workflows/.NET%20Core/badge.svg?branch=master)\n\n## 集成接口功能\n\n| 接口名称                      | 接口说明                          | 使用场景                                                                                                                                             |\n| :---------------------------- | :-------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- |\n| IJT808SessionProducer         | 会话通知（在线/离线）数据生产接口 | 有些超长待机的设备，不会实时保持连接，那么通过平台下发的命令是无法到达的，这时候就需要设备一上线，就即时通知服务去处理，然后在即时的下发消息到设备。 |\n| IJT808SessionConsumer         | 会话通知（在线/离线）数据消费接口 | -                                                                                                                                                    |\n| IJT808MsgProducer             | 数据生产接口                      | 网关将接收到的数据发送到队列                                                                                                                         |\n| IJT808MsgConsumer             | 数据消费接口                      | 将数据进行对应的消息业务处理(例：设备流量统计、第三方平台数据转发、消息日志等)                                                                       |\n| IJT808MsgReplyProducer        | 应答数据生产接口                  | 将生产的数据解析为对应的消息Id应答发送到队列                                                                                                         |\n| IJT808MsgReplyConsumer        | 应答数据消费接口                  | 将接收到的应答数据下发给设备                                                                                                                         |\n| IJT808MsgReplyLoggingProducer | 网关应答数据日志生产接口          | 将网关能解析到直接能下发的数据发送到队列                                                                                                             |\n| IJT808MsgReplyLoggingConsumer | 网关应答数据日志消费接口          | 将网关能解析到直接能下发的数据发送到日志系统                                                                                                         |\n\n\u003e 使用物联网卡通过udp下发指令时，存储的那个socket地址端口，有效期非常短,不速度快点下发，那个socket地址端口就可能映射到别的对应卡去了,所以此处采用跟随设备消息下发指令。\n\n## 基于WebApi的消息业务处理程序\n默认不提供api，但如果使用webapi项目集成网关，如[JT808.Gateway.SimpleServer](simples/JT808.Gateway.SimpleServer/Program.cs#L45)，可通过如下方式添加[自带的api](src/JT808.Gateway/JT808GatewayApiExtensions.cs)\n\n```c#\napp.UseJT808GatewayWebApi();\n```\nor\n```c#\napp.UseJT808GatewayWebApi(options=\u003e{\n    options.RoutePrefix = \"jt808api\"; //指定路由前缀\n    options.VerifyAuthorization = true; //启用token鉴权\n});\n```\n\n[接口文档](api/README.md)\n\n## 基于Pipeline\n\nPipeline分为两种方式使用，一种是使用队列的方式，一种是网关集成的方式。\n\n| 使用方式     | 特性                                                                               | 备注                                         |\n| :----------- | :--------------------------------------------------------------------------------- | :------------------------------------------- |\n| 使用队列     | 网关不需要重启，相当于透传数据，设备上来的数据直接入队列，通过服务去处理消息。     | 设备多的可以这样搞，这样关注点在业务上面。   |\n| 使用网关集成 | 网关需要根据消息业务的变化去处理，也就意味着更改业务，需要重启网关，但是上手简单。 | 设备少的，开发能力弱的，允许设备丢点数据的。 |\n\n### Pipeline的NuGet安装\n\n| Package Name                                   | Version                                                                                              | Preview  Version                                                                                        | Downloads                                                                                             |\n| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |\n| Install-Package JT808.Gateway.Abstractions     | ![JT808.Gateway.Abstractions](https://img.shields.io/nuget/v/JT808.Gateway.Abstractions.svg)         | ![JT808.Gateway.Abstractions](https://img.shields.io/nuget/vpre/JT808.Gateway.Abstractions.svg)         | ![JT808.Gateway.Abstractions](https://img.shields.io/nuget/dt/JT808.Gateway.Abstractions.svg)         | ![JT808.Gateway.Abstractions](https://img.shields.io/nuget/dt/JT808.Gateway.Abstractions.svg) |\n| Install-Package JT808.Gateway                  | ![JT808.Gateway](https://img.shields.io/nuget/v/JT808.Gateway.svg)                                   | ![JT808.Gateway](https://img.shields.io/nuget/vpre/JT808.Gateway.svg)                                   | ![JT808.Gateway](https://img.shields.io/nuget/dt/JT808.Gateway.svg)                                   |\n| Install-Package JT808.Gateway.WebApiClientTool | ![JT808.Gateway.WebApiClientTool](https://img.shields.io/nuget/v/JT808.Gateway.WebApiClientTool.svg) | ![JT808.Gateway.WebApiClientTool](https://img.shields.io/nuget/vpre/JT808.Gateway.WebApiClientTool.svg) | ![JT808.Gateway.WebApiClientTool](https://img.shields.io/nuget/dt/JT808.Gateway.WebApiClientTool.svg) |\n| Install-Package JT808.Gateway.Client           | ![JT808.Gateway.Client](https://img.shields.io/nuget/v/JT808.Gateway.Client.svg)                     | ![JT808.Gateway.Client](https://img.shields.io/nuget/vpre/JT808.Gateway.Client.svg)                     | ![JT808.Gateway.Client](https://img.shields.io/nuget/dt/JT808.Gateway.Client.svg)                     |\n| Install-Package JT808.Gateway.Kafka            | ![JT808.Gateway.Kafka](https://img.shields.io/nuget/v/JT808.Gateway.Kafka.svg)                       | ![JT808.Gateway.Kafka](https://img.shields.io/nuget/vpre/JT808.Gateway.Kafka.svg)                       | ![JT808.Gateway.MsgIdHandler](https://img.shields.io/nuget/dt/JT808.Gateway.MsgIdHandler.svg)         |\n\n## 举个栗子\n\n### Pipeline\n\n#### 使用网关集成方式\n\n1.打开/simples/JT808.Simples.sln项目进行还原编译生成\n\n2.进入JT808.Gateway.SimpleServer项目下的Debug目录运行服务端\n\n3.进入JT808.Gateway.SimpleClient项目下的Debug目录运行客户端\n\n如图所示：\n![demo3](doc/img/demo3.png)\n\n#### 使用队列方式\n\n1.打开/simples/JT808.Simples.sln项目进行还原编译生成\n\n2.JT808.Gateway.SimpleQueueServer项目下的Debug目录运行服务端\n\n3.JT808.Gateway.SimpleQueueService项目下的Debug目录运行消息处理服务\n\n4.JT808.Gateway.SimpleQueueNotification项目下的Debug目录运行WebSocket服务\n从浏览器中打开localhost:5000查看数据\n\n5.进入JT808.Gateway.SimpleClient项目下的Debug目录运行客户端\n\n\u003e 注意：需要安装kafka和zookeeper\n\n如图所示：\n![demo4](doc/img/demo4.png)\n\n## Docker\n\n此处以`vscode`为例，使用`vscode`打开当前文件夹\n\n打包镜像\n\n\u003e当前仅打包[`simples/JT808.Gateway.SimpleServer`](simples/JT808.Gateway.SimpleServer)，可根据需求自行更改\n\n- 按下`F1`按键\n- 选择运行任务\n- 选择打包示例网关镜像\n\n运行容器\n- 运行`docker compose up`\n\n使用tcp工具或本项目中的示例项目测试本地`808`端口，\n\n## 常见问题\n\n- 多协议兼容实现思路[点我查看](https://github.com/SmallChi/JT808Gateway/issues/11#issuecomment-727687417)\n\n\u003e 单端口兼容多协议虽然可以实现，但是还是不建议这么做，建议最好是用端口分开，避免不必要的麻烦\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallchi%2Fjt808gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallchi%2Fjt808gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallchi%2Fjt808gateway/lists"}