??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美激情一区二区久久久 ,91精品久久久久久,国产精品久久久久毛片大屁完整版http://www.aygfsteel.com/jb2011/我的最新工EMobileIMSDKQhttp://git.oschina.net/jackjiang/MobileIMSDKzh-cnThu, 01 May 2025 16:03:37 GMTThu, 01 May 2025 16:03:37 GMT60全^台开源即旉讯IM框架MobileIMSDKQ??TCP/UDP/WebSocket协议Q`蒙NEXT端已发布Q?.7K Starshttp://www.aygfsteel.com/jb2011/archive/2025/04/29/451615.htmlJack JiangJack JiangTue, 29 Apr 2025 07:29:00 GMThttp://www.aygfsteel.com/jb2011/archive/2025/04/29/451615.htmlhttp://www.aygfsteel.com/jb2011/comments/451615.htmlhttp://www.aygfsteel.com/jb2011/archive/2025/04/29/451615.html#Feedback0http://www.aygfsteel.com/jb2011/comments/commentRss/451615.htmlhttp://www.aygfsteel.com/jb2011/services/trackbacks/451615.html一、基本介l?/h1>

MobileIMSDK是一套全q_原创开源IM通信层框Ӟ

  • 轻量、高度提|lib?0KB以内Q?/li>
  • _ֿ装Q一套API同时支持UDP、TCP、WebSocket三种协议Q可能是全网唯一开源的Q;
  • 客户端支持iOS、Android、标准Java、H5、微信小E序、Uniap、`蒙Next(Demo完整源码)Q?/li>
  • 服务端基于NettyQ性能卓越、易于扩?nbsp;newQ?/li>
  • 可与姊妹工程 MobileIMSDK-Web 无缝互通实现网늫聊天或推送等Q?/li>
  • 可应用于跨设备、跨|络的聊天APP、企业OA、消息推送等各种场景?/li>

二、源码仓库同步更?/h1>

GitHub.comQ?/strong>

码云giteeQ?/strong>

三、设计目?/h1>

让开发者专注于应用逻辑的开发,底层复杂的即旉讯法交由SDK开发h员,从而解偶即旉讯应用开发的复杂性?/p>

四、框架组?/h1>

整套MobileIMSDK框架׃?部分l成Q?/strong>

  1. Android客户端SDKQ?/strong>用于开发Android版即旉讯客户端,支持Android 4.0及以上版本,查看API文档Q?/li>
  2. iOS客户端SDKQ?/strong>用于开发iOS版即旉讯客户端,支持iOS 12.0及以上版本,查看API文档Q?/li>
  3. Java客户端SDKQ?/strong>用于开发跨q_的PC端即旉讯客户端,支持标准Java 1.6及以上版本,查看API文档Q?/li>
  4. H5客户端SDKQ?/strong>查看_注释?/a>Q?/li>
  5. 微信程序端SDKQ?/strong>查看_注释?/a>Q?/li>
  6. Uniapp端SDKQ?/strong>查看_注释?/a>Q?/li>
  7. 鸿蒙Next端SDKQ?/strong>SDK暂无开源版Q?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">查看_注释?/a>Q,Demo完整工程源码Q?/li>
  8. 服务端SDKQ?/strong>用于开发即旉讯服务端,支持Java 1.7及以上版本,查看API文档Q?/li>

整套MobileIMSDK框架的架构组成:

MobileIMSDK一直在持箋开发和升中,鸿蒙Next客户?/a>是MobileIMSDK工程的最新成果?/p>

五、技术特?/h1>

六、演C程?/h1>
  1. Android客户?DemoQ?/strong>Ҏ安装和?/a>Q?/li>
  2. iOS客户?DemoQ?/strong>Ҏ安装和?/a>Q?/li>
  3. Java客户?DemoQ?/strong>Ҏ安装和?/a>Q?/li>
  4. H5客户?DemoQ?/strong>Ҏ查看介绍Q?/li>
  5. 微信程序端 DemoQ?/strong>Ҏ查看介绍Q?/li>
  6. Uniapp?DemoQ?/strong>Ҏ查看介绍Q?/li>
  7. 鸿蒙Next?DemoQ?/strong>Ҏ查看介绍 newQ?/li>
  8. 服务?DemoQ?/strong>Ҏ安装和?/a>?/li>

七、应用案?/h1>

RainbowChat是一Ƒ֟于MobileIMSDK的品聊天APPQ更多详情:点击下蝲体验 ?nbsp;查看q行截图?/p>

① ZMobileIMSDK的品聊天APPQ?/strong>

▶ 详细介绍?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">下蝲体验 ?nbsp;查看q行截图?/p>

② MobileIMSDK在高|络延迟下的案例Q?/strong>

▶ 某款ZMobileIMSDK的商业商品,曾运营于跨洲际的复杂|络环境下,端到端通信延迟在洲际网l繁忙时可高?00ms以上Q与服务端的单向延迟Uؓ300ms左右Q而通常大家讉K国内L门户的gq约?0~50msQ,某段时期的非敏感q营数据 Ҏ查看?/p>

八、打包下载(all in oneQ?/h1>

说明Q?/strong>最新发布版打包内容中,已包含完整的demo源码、sdk源码、api文档、编译后的分发包{?/p>

九、典型应用场?/h1>

场景1Q聊天APP

应用说明Q?/strong>可用于开发类g微信、QQ{聊天工兗?/p>

消息走向Q?/strong>需使用C2C、C2S、S2C全部cd?/p>

特别说明Q?/strong>MobileIMSDKq未定义聊天应用的应用层逻辑和协议,开发者可自行定义q实C?/p>

场景2Q消息推?/strong>

应用说明Q?/strong>可用于需要向客户端实时推送信息的各种cdAPP?/p>

消息走向Q?/strong>仅需使用S2C 1U消息走向,属MobileIMSDK的最单应用场景?/p>

场景3Q企业OA

应用说明Q?/strong>可用于实C业OA的指令、公文、申L各种消息实时推送,极大提升用户体验Qƈ可g伸至Ud讑֤?/p>

消息走向Q?/strong>仅需使用S2C 1U消息走向,属MobileIMSDK的最单应用场景?/p>

场景4Q企业OA的增强型

应用说明Q?/strong>可用于实C业OA中各U系l、用L消息的实时互动,充分利用x通讯技术提升传lOA的h倹{?/p>

消息走向Q?/strong>可用C2C、C2S、S2C全部cdQ这与聊天APP在很多方面已无差别,但企业OA有自已的用户关系理模型和逻辑Q较之全功能聊天APP要简单的多?/p>

十、开发指?/h1>
  1. Android客户端开发指南:Ҏ查看Q?/li>
  2. iOS客户端开发指南:Ҏ查看Q?/li>
  3. Java客户端开发指南:Ҏ查看Q?/li>
  4. H5客户端开发指南:Ҏ查看Q?/li>
  5. 微信程序端开发指南:Ҏ查看Q?/li>
  6. Uniapp端开发指南:Ҏ查看Q?/li>
  7. 鸿蒙Next端开发指南:Ҏ查看Q?/li>
  8. Server端开发指南:Ҏ查看?/li>

附录1QDemo截图

1、在鸿蒙Next端运行效果:

>> ~译和运行:查看鸿蒙Next端Demo完整源码?/p>

2、Android端、iOS端运行效?/strong>

>> 安装和用:q入Android版Demo帮助?/a>?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">q入iOS版Demo帮助?/a>?/p>

>> 安装和用:q入Java版Demo帮助?/a>?/p>

>> 安装和用:q入Java版Demo帮助?/a>?/p>

8.1QMobileIMSDK-Web在手机端览器运行效果:Q如何获取MobileIMSDK-Web版:Ҏq入Q?/p>

8.2QMobileIMSDK-Web在PC端浏览器q行效果Q(如何获取MobileIMSDK-Web版:Ҏq入Q?/p>

附录2Q基于MobileIMSDK的全功能IM【案例?/span>

>> 关于RainbowChat的更多资料请见:RainbowChat前端APP功能截图|页 Q?span style="color: #ff00ff;">* 推荐 - 真机实拍视频Q?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Andriod?/a>?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">iOS?/a>Q?/p>

附录3Q基于MobileIMSDK-Web的网늫IMpȝ【案例?/strong>

下图为RainbowChat-Web的主界面Q?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">更多截图Ҏq入?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">更多演示视频Ҏq入Q:

下图为RainbowChat-Web的主界面[聊天H全屏时] Q?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">更多截图Ҏq入?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">更多演示视频Ҏq入Q:

下图为RainbowChat-Web的主界面[独立UI效果] Q?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">更多截图Ҏq入?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">更多演示视频Ҏq入Q:

Q?strong>以上内容同步发布于:http://www.52im.net/thread-52-1-1.html Q?/div>

Jack Jiang 2025-04-29 15:29 发表评论
]]>拥抱国化:转{APP的`蒙NEXT端开发尝鲜之?/title><link>http://www.aygfsteel.com/jb2011/archive/2025/04/23/451612.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Wed, 23 Apr 2025 02:50:00 GMT</pubDate><guid>http://www.aygfsteel.com/jb2011/archive/2025/04/23/451612.html</guid><wfw:comment>http://www.aygfsteel.com/jb2011/comments/451612.html</wfw:comment><comments>http://www.aygfsteel.com/jb2011/archive/2025/04/23/451612.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jb2011/comments/commentRss/451612.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jb2011/services/trackbacks/451612.html</trackback:ping><description><![CDATA[<blockquote style="background-image: none; border-top: none; border-right: none; border-bottom: none; border-left-width: 3px; border-left-color: #e2dfdf; margin-right: 0px; margin-left: 0px; background-color: #eeeeee; width: 884.475px; color: #555555; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;"><p style="margin-top: 10px; margin-bottom: 10px;">本文p{转技术团队n卫兵分nQ原?#8220;鸿蒙新篇章:转{ APP ?HarmonyOS Next 开发之?#8221;Q下文进行了排版优化和内容修订?/p></blockquote><h1>1、引a</h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">2023 q在华ؓ开发者大会(HDC.TogetherQ上Q除了面向消费者的 HarmonyOS 4 之外Q华推出了面向开发者的 HarmonyOS Next 开发者预览?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">而在d?6 月䆾华ؓ开发者大会上Q对外开启了 HarmonyOS Next Beta 版,q在当年内正式推出面向消费者的商用版本?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">HarmonyOS NextQ是鸿蒙生态的一个重要拐炏V去q的时候,转{和华为已l达成合作,作ؓ鸿蒙先锋的一员,加入到`蒙应用的开发之中来?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">客户端从 2023 q?11 月䆾开始,人力开始逐渐的往q个方向投入Q于 2024 q?2 月䆾正式开始进入业务开发,?6 ?4 P对外正式发布了基?HarmonyOS Next pȝ的{?App 首个版本?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202504/1834368-20250423101903301-776550854.jpg" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /><p style="margin-top: 10px; margin-bottom: 10px;"><strong>从早期的学习到最l第一个版本上U,我们l历了以下几个阶D:</strong></p></div><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>前期的熟悉和学习q程Q?/li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>鸿蒙客户端基建开发过E;</li><li style="list-style: inherit;"><strong><em>3Q?/em></strong>首个版本需求范围确定和排期Q?/li><li style="list-style: inherit;"><strong><em>4Q?/em></strong>业务开发;</li><li style="list-style: inherit;"><strong><em>5Q?/em></strong>试Q?/li><li style="list-style: inherit;"><strong><em>6Q?/em></strong>bug 修复/性能调优Q?/li><li style="list-style: inherit;"><strong><em>7Q?/em></strong>上线?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>本文要分n的是转{APP在开发全新`蒙NEXT端所遇到的一些问题,Ҏ了`蒙开发和 Android、iOS 的不同,ȝ了这ơ开发过E中的一些经验等{。希望能带给你启发?/strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202504/1834368-20250423101914656-759515321.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"> </div><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"> </div><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><p style="margin-top: 10px; margin-bottom: 10px;"><strong>技术交:</strong></p><div><div><div><p style="margin-top: 10px; margin-bottom: 10px;">- Ud端IM开发入门文章:?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">新手入门一就够:从零开发移动端IM</a>?/p><p style="margin-top: 10px; margin-bottom: 10px;">- 开源IM框架源码Q?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">https://github.com/JackJiang2011/MobileIMSDK</a>Q?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">备用地址Ҏ</a>Q?/p></div></div></div><p style="margin-top: 10px; margin-bottom: 10px;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Q本文已同步发布于:http://www.52im.net/thread-4820-1-1.htmlQ?/a></p></div><h1>2、关于作?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>赵卫兵:</strong>目前负责转{集团 iOS 和`蒙系l?App 基础架构和相兛_。崇开源和分n_QSharing is everything ~</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>转{团队分n的其它几技术文章有兴趣也可M读:</strong></p><ol style="padding-left: 40px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">转{q_IMpȝ架构设计与实?一)Q整体架构设?/a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">转{q_IMpȝ架构设计与实??Q详l设计与实现</a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Web端IM聊天消息该不该用览器本地存储?一文即?/a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">手把手教你用网l编E抓包神器Wireshark</a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">谈|页端IM技术及相关试Ҏ实践Q包括WebSocket性能试Q?/a></li></ol><h1>3、初识`蒙NEXT</h1><h3>3.1 分布式技?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">HarmonyOS Next 具备强大的分布式技术,能够实现跨设备协同工作。用户可以无~地在不同的讑֤间切换和使用应用Q无需感知讑֤的差异。HDC 大会中如 WPS Office、高L APPQ用了应用接箋Ҏ,在不同设备中q行{Qo人印象深刅R这点在 iOS ?Android 中ƈ不完全具备?/p><h3>3.2 高性能低时?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">HarmonyOS Next采用轻量U的微内核设计?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">iOS 使用的内核基?XNUQX is Not UnixQ内核,XNU 是一个؜合内核,l合了微内核QMach 内核Q的内存理、Q务调度、进E间通信{特性和宏内核(BSD 内核Q的文gpȝ、网l堆栈、用戯E管理等Ҏ?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">Android 内核Z修改q的 Linux 宏内核,增加?Binder IPC、电源管理、安全性等模块和机Ӟ以更好的支持Ud讑֤?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">鸿蒙的微内核设计Q官方称相比宏内核,具备更高的性能和更低的时gQ从而在多Q务处理、设备响应和处理能力上具有明显优ѝ?/p><h3>3.3 自适应UI框架</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">通过 ArkUI和ArkTSQHarmonyOS Next能够适应各种寸和Ş状的屏幕讑֤Q提供一致友好的用户体验。这个特性在跨设备协同时其重要?/p><h3>3.4 多终端、多OS支持</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">HarmonyOS Next 不仅仅是一个手机操作系l,q能q行在^ѝ智能穿戴设备、智能家居设备等多种l端上,l一生态系l。对比苹果的iOSQMacOSQTVOSQWatchOSQ确实有些不同。但对于应用开发者而言Q其实就是API的能力集合问题,q一点,鸿蒙使用 SysCap pȝ能力集合辑ֈ了殊途同归的效果?/p><h3>3.5 更优U的安全?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>在应用安全层面,目前在应用的生态中有以下一些问题:</strong></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>诱导用户下蝲安装恶意应用Q?/li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>H取用户数据Q?/li><li style="list-style: inherit;"><strong><em>3Q?/em></strong>强制推送广告;</li><li style="list-style: inherit;"><strong><em>4Q?/em></strong>利用漏洞d其他应用E序Q?/li><li style="list-style: inherit;"><strong><em>5Q?/em></strong>盗版软g?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">q方面,׃Android 的开放性以及侧载安装的支持Q问题表现的ؓ明显Q?iOS 是一个可以学习的老师?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>针对上面的问题,HarmonyOS Next 又是如何应对的呢Q?/strong></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>做好应用质量的监,控制应用分发渠道Q避免恶意应用分发到用户讑֤上;</li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>提供安全的数据授权机Ӟ避免用户q度授权造成安全威胁Q?/li><li style="list-style: inherit;"><strong><em>3Q?/em></strong>l应用程序开攄pȝ功能做到不被恶意利用Q?/li><li style="list-style: inherit;"><strong><em>4Q?/em></strong>帮助应用E序最程度的受到漏洞影响Q?/li><li style="list-style: inherit;"><strong><em>5Q?/em></strong>为应用程序提供有效的核心数字产权保护手段Q避免出现盗版Y仉题?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>具体可以看下图:</strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202504/1834368-20250423101926293-1210774772.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">Q图片来自《`蒙生态应用安全技术白皮书 V1.0》)</p><h1>4、和Android、iOS的开发有何不同?</h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">鸿蒙开发上Q和 Android、iOS q是有不相似和不同的地方,我挑选感受比较深ȝ几个点说下?/p><h3>4.1 开发语a和工具链</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">鸿蒙开发用的是ArkTS 语言QArkTSZ TypeScript 做了一些扩展,l承?TypeScript 的所有特性,?TypeScript 的超集?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>下面是官方的一些介l:</strong></p><blockquote style="background-image: none; border-top: none; border-right: none; border-bottom: none; border-left-width: 3px; border-left-color: #e2dfdf; margin-right: 0px; margin-left: 0px; background-color: #eeeeee; width: 884.475px; color: #555555; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;"><p style="margin-top: 10px; margin-bottom: 10px;">ArkTS的一大特性是它专注于低运行时开销。ArkTS对TypeScript的动态类型特性施加了更严格的限制Q以减少q行时开销Q提高执行效率。通过取消动态类型特性,ArkTS代码能更有效地被q行前编译和优化Q从而实现更快的应用启动和更低的功耗?/p><p style="margin-top: 10px; margin-bottom: 10px;">与JavaScript的互通性是ArkTS语言设计中的关键考虑因素。鉴于许多移动应用开发者希望重用其TypeScript和JavaScript代码和库QArkTS提供了与JavaScript的无~互通,使开发者可以很Ҏ地将JavaScript代码集成C们的应用中。这意味着开发者可以利用现有的代码和库q行ArkTS开发?/p></blockquote><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>在开发工具上Q?/strong>使用?IDE ?DevEco StudioQ基?IntelliJ IDEA Community 开源版本打造,为开发者提供工E模板创建、开发、编译、调试、发布等功能。华为在q个 IDE 上针寚w`蒙开发易用性上做了大量的工作,包含但不限于~译器,代码实时预览、ArkUI Inspector、Profile 性能分析工具{等?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>在包理上:</strong>有点cM前端?npm 包管理机Ӟ不过在这块,是叫 ohpmQ整体上非常怼Q但是细节上有一些不同,譬如 package.json 的文件命名、lock 文g的内容信息、独立的开源中心仓{等。仓库这块也提供了私仓部|的方式Q采用套件工具中?ohpm-repo可以部|到企业内部服务器上?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>在调试上Q?/strong>?Android ?ADB cMQ`蒙这块提供了一?hdc 的工P提供了类似查询设备列表、网l、文件、应用安装卸载、shell、日志获取等常用功能?/p><h3>4.2 开发体?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">鸿蒙开发是?ArkUIQ类?FlutterQSwiftUI q样的声明式 UIQArkUI lg的命名和状态管理和 SwiftUI 比较cMQ上手比较容易?/p><h3>4.3 开发资料和交流</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">Android ?2008 q谷歌布QiOS ?2007 q苹果发布,距离到现在已l有?16?7 q之久,在这期间Q互联网上积累了无数的开发资料和l验分nQ也有着大量的开源项目和C֌?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">而有?HarmonyOS Next 斚w的资料,目前更多的是官方开发指南和开源范例(集中?gitee 上)?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">C֌斚wQ主要是华ؓ开发者论坛,受限于开发者版本的q速P代,一些帖子讨论的内容已经q时且不再适用?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">而在博客、github 开源上Q目前看到的其实q不多,更多的分享还是比较基Q深度有价值的q不多?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">目前在这个阶D,更多的是企业和华为合作的情况下,内部使用 Issue 工单pȝq行沟通交。交主要围l着需求、Bug 反馈、指南疑问来展开?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>譬如Q?/strong></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>指南资料中提供的能力Q不满诉求Q交是否有更好的解x案;</li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>API 、IDE、工具链表现不符合预期,反馈 bugQ?/li><li style="list-style: inherit;"><strong><em>3Q?/em></strong>pȝ能力cL Android、iOS ~失的特性,交流是否有替代的解决Ҏ?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">截止到本文章写的时候,转{华ؓ工单交流的L已达?270+个。反馈的 bug 和缺q能力Q在后面的开发者预览版本中都被修复或支持了?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>印象比较深刻的一件事是:</strong>开发和试期间我们发现了停留在d面不动Q过?0 分钟左右Q系l就会卡死重启,我们一度以为是 App 哪里?bug。我们通过 hdc hilog 抓取pȝ输出的日志,发现大约q了 10 分钟左右Qlog ׃d@环打华ͼ很明昄l底层发生了一些异常。已l晚上快 1 点了Q我们兴奋的扑ֈ和我们对接这个问题的华ؓ工程师张老师Q将视频和日志发送给他,张老师按照复现的\径,也成功复现出来,q且抓取到日志。后面的几天Q经q华Z伴的努力Q终于定位到问题所在,是文件句?FD 存在泄露的情况,q在下一个开发者版本中推送修复了?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">为华为工E师的敬业和效率竖一个大拇指Q华Z所以强大,从这件事的跟q和解决效率上,p理解Cؓ什么?/p><h1>5、踩坑后ȝ的几个经?/h1><h3>5.1 cL学习</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">投入鸿蒙开发的客户端同学,有来?Android 开发的Q也有来?iOS 开发的Q或多或对另外一端的pȝ了解的不是很全面?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在学习的q程中,我们发现鸿蒙的一些特性和 API 设计Q有些和 iOS 比较像,而有些和 Android 有些像。我们内部经常讨Z和理解 HarmonyOS Next 的应用层设计问题。在Ҏ选择上,HarmonyOS Next 中都有借鉴和取舍?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>q个阶段Q?/strong>我们需要重点理解`蒙特有的一些设计概念和思想。譬?Stage 模型QStage模型是从 API 9 开始新增的模型Q是目前L且会长期演进的`蒙应用模型。在该模型中Q由于提供了 AbilityStage、WindowStage {类作ؓ应用lg?Window H口?#8220;舞台”Q这U方式在 Android、iOS 上是不是有类似的概念呢?</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">如果我们如下cL Android、iOS?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>AbilityStage ?WindowStageQ?/strong></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>?iOS 中,?UIViewController ?UIWindow cM。UIViewController 理视图层次和界面行为,?UIWindow 是应用程序的H口Q可以显C内容;</li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>?Android 中,可以cL?Activity ?Window。Activity 是应用的单个屏幕Q负责界面的创徏和管理,?Window ?Activity 的顶层视囑֮器?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>UIAbility ?ExtensionAbilityQ?/strong></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>UIAbility 可以?iOS ?UIViewController 以及 Android ?Activity 相对应,因ؓ它们都是用于理和显C用L面的基本单元?/li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>ExtensionAbility 可以cL?iOS ?App Extension ?Android ?Service。App Extension 提供了将功能扩展到系l范围内的能力,?Service ?Android 中则是运行在后台的组Ӟ执行长时间运行的操作?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">虽然l节有所不同Q但大方向上q样Ҏ和类比,会帮助我们快速理解`蒙相兛_发概c?/p><h3>5.2 目理和风险方案应?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">首个版本的开发,几乎涉及C公司所有的业务部门Q我们通过启动会拉齐背景信息,前期让大家梳理到新增一个`蒙终端对业务的媄响范_以及解决Ҏ?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><span style="color: #3366ff;"><strong><em>1QPlanB ҎQ?/em></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">一些三?SDK 如微信、支付宝{在前期都是没有的,我们首个版本需要做?PlanB Ҏ。涉及到的包括登录、支付、分享等业务Q都需要针对这些进行调整?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><span style="color: #3366ff;"><strong><em>2Q有限的试机:</em></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">因ؓ业务部门参与q来的很多,但工E样机十分有限。服务端和前端同学代码调整完毕后如何试呢?q个是我们不得不考虑的一件事情?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">新增一个`蒙终端,服务端调整后端代码,在测试和沙箱试Ӟ除了回归不要影响 Android ?iOS 之外Q还要能保证针对鸿蒙的兼容调整是有效的。鉴于`蒙测试机器十分有限,我们l?Server 同学提供?Android 试包,?Android 试包的l端 mock 成`蒙终端来供服务端试接口Q这样子试下来十分高效?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>针对前端同学Q?/strong>不能再向刚才那样做了Q毕竟是?Android ?WebView。即便我?WebView ?UserAgent mock ?Android pȝQ得通信和交互仍然走cM Android 的策略,而这样ƈ不能代表真实的`?WebView 环境Q因为在 Next pȝ中整?Native ?Webview 的通信 Bridge 是全新的一套方案,且`蒙的 API 实现接口也都需要走鸿蒙侧来试。针对这个情况,我们非常谨慎心的将各个业务部门的参与进来的旉错开Q尽力保证在有限试机的情况下,每个业务轮{参与q来的时候都是有机器的?/p><h3>5.3 多和华ؓ伙伴q行沟?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">q部分的l验Q具有一定的时效性。后期商用版本发布之后,可能q样的沟通渠道、频ơ很隑ֆ有了?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">Z么要多和华ؓ伙伴时刻保持密切的沟通?有几个印象深ȝ例子?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><span style="color: #3366ff;"><strong><em>1Q第一个例子:路由</em></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">鸿蒙关于面跌{提供了两套解x案,一套是面路由 routerQ一套是lgD Navigation。前期我们在基徏开发期_采用的页面\?router ҎQ@zz/router lg代码已经开发完毕了Q但是到了开?WebView ?Hybrid 接口Ӟ才意识到一个严重的问题Q就?router 提供的能力,q不能满x们复杂的面栈管理,譬如在页面栈中多?WebViewQ我们需要关闭指定的 WebView 面Qrouter 提供?API 能力是无法做到的。和华ؓ沟通后才知道,官方是推?Navigation 来实玎ͼ且未?router Ҏ不再演进。我们提出的复杂面栈管理的能力Q彼?Navigation 支持的还不完_但是伙伴告诉我们Q他们会?Navigation 上满x们的需求。关闭页面栈中指?index 或?name 的页面,怿其他开发者也都会遇到Q应该是一个普遍的需求?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">Zq种情况Q我们不得不q速调整我们的路由lgQ基?Navigation 重新设计了一套\由方案,q好目业务q没有开始大量开发,要改动的地方也不是很多,如果沟通再晚点Q恐怕调整v来代价会相对更高炏V此时的沟通,让我们少C弯\Q避免在 router 上走投无路死方案?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><span style="color: #3366ff;"><strong><em>2Q第二个例子Q企业分?/em></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">企业分发通常用于企业内部试、企业内?App {。Dev 证书?iOS ?Dev 证书cMQProvisioning ProfileQp7b 文gQ会?100 台设备的限制。考虑到将来,转{也想依赖企业分发能力Q可以在试中采用企业签名打包来q行试。虽说在当前阶段不是性和必要的,但是我们q有一个{转质 AppQ这?App 我们不能通过 AGC 后台上架华ؓ市场Q因为在质检中心Q如果不走内部分发安装,那么我们会面着外网下蝲Q会l质中心的带宽带来很大的负蝲以及成本?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">我们密切x者企业分发能力的qA旉Q在今年?5 月䆾QAGC 后台企业分发能力提供之后Q立卌行了全流E处理,包括甌企业开发者、申误书以及测试走通下载整个过E。这U情况下Q通过及时交流Q我们可以第一旉q行试实践Q有效降低或者避免了未来Ҏ上的一些风险?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><span style="color: #3366ff;"><em>3Q第三个例子Q安全控件与pȝ Picker</em></span></strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">怿q大开发者今q刚开始介?HarmonyOS Next 开发时Q对于用到的一些权限,如读取剪贴板Q读取或者保存图片到相册{等q些 ACLQAccess Control ListQ访问控制列表权限,都是通过在开发者后台勾选这些权限从而实现在应用中弹H许可访问。但是在今年 6 月䆾的沟通中Q我们获知后面要让开发者全部适配到安全控件方案。这些安全控仉是系l提供的选择器,使用之后Q每ơ需要用h操作才行?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">目前?Android ?iOS 中,如果惌在应用中上传一张照片,需要同意该应用获得囑ֺ的访问权限,而带来的弊端是Q这个应用今后可随意讉K你图库中的所有图片。相比之前的授权弹窗许可一ơ之后,可能造成的权限滥用,安全控g提升了用户对敏感权限的操作感知,是 HarmonyOS Next 在保障用户隐U安全方面的一个亮点和优势?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">q其中的核心理念便是从权限管控到数据控。在 Android ?iOS 原本的权限管控方案中Q比如一旦给了通讯录权限,那么相当于把通讯录的钥匙l予了应用开发者,如果开发者违规用,在用户不知情的读取整个通讯录,其实是不W合用户的隐U要求。而数据管控便是不会再把通讯录的钥匙l开发者,而是你要什么样的通讯录数据,那么你只能通过通讯录安全选择控g中来选择惌d的通讯录,不再让应用随意获取整个通讯录数据?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">关于安全控g我们q行了多ơ沟通,了解了安全控件在华ؓ侧推q的节奏以及我们整改的期限时间等Q另外我们也提出个别场景Q安全控件还不以满求,譬如用户保存囄到相册,q没有对应的安全控g能力。这斚w的沟通,会让我们及时的对 App 的隐U合规性做Z化调_避免后面因ؓ隐私权限问题而媄响上架?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">及时沟通对于了?Bug 的解x况,功能交付旉、华Z伴的要求{都是很有必要的Q因些都会媄响到开发测试到上线的一个节奏?/p><h1>6、`蒙NEXT上的WebView混合面开?/h1><h3>6.1 概述</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">回到我们大前端来Q得提一下大家关注的 WebView。在 HarmonyOS Next 中仍然沿用之前统一?WebView 架构?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>?V1 版本中,需要做的核心工作包括:</strong></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>实现 WebView Core 层;</li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>JSBridge 层,新增实现 HarmonyOS Next ?Bridge 通信Q?/li><li style="list-style: inherit;"><strong><em>3Q?/em></strong>q移安全层能力;</li><li style="list-style: inherit;"><strong><em>4Q?/em></strong>实现 Hybrid API 接口Q也是 Ability 层的能力?/li></ul><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202504/1834368-20250423101945099-1812928023.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /><p style="margin-top: 10px; margin-bottom: 10px;"><strong>需要特别提一下的是:</strong>HarmonyOS Next 使用?Web 览器基?ArkWebQ方舟Web内核Q,该内核基?Chrome 114 版本定制Q对于各U?CSS、HTML、JS 属性在各大览器中的兼Ҏ情况可以?nbsp;<a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">https://caniuse.com/#home</a> q个|站q行查询?/p></div><h3>6.2 前期如何定影响范围和制定方?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>Ability 层的接口Q?/strong>转{?WebView 历经多年的演q,Native ?WebView 的交?API 是有一定历史包q。我们不希望鸿蒙q次l箋背着包袱前行Q所以我们计划趁着q次前端业务兼容鸿蒙的机会,q行一波优化,丢弃一些已l计划不再用的能力或者接口。比如老的半屏 WebView ҎQ导航栏按钮功能讄Ҏ、非l蟩的页面蟩转接口等?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">但一个方案的定要充分考虑客户端实现的难易E度以及前端大量业务侧统一修改的难度代P需要做到尽可能的合理^衡。ؓ了确定这点,我们ҎU上最q一个月中URL 中接口调用的埋点日志Q结?URL 查询所属业务、开发测试负责h的内部接口,整理了一张巨大的二维矩阵表,通过在线表格的过滤、筛选等功能Q可以非常直观的看到所有还在用中的接口的业务调用分布情况Qؓ我们评估Ҏ攚w工作量提供了重要的参考?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202504/1834368-20250423101954901-796349277.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /><p style="margin-top: 10px; margin-bottom: 10px;">一?Hybrid API 在`蒙上支持情况Q分Z面几U情c?/p></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><span style="color: #3366ff;"><strong><em>aQ?直接支持Q前端无需修改Q提供和 Android、iOS 一L接口能力Q?/em></strong></span></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>功能对等Q能力实现和 Andriod、iOS 一P</li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>化:比如览大图、奢侈品鉴定Q暂时用简版选图Ҏ?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><span style="color: #3366ff;"><strong><em>bQ?推荐使用新方案:</em></strong></span></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>譬如D栏相x钮的能力、新半屏能力Q?/li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>?enterChat {等功能Q用统x口来实现跌{?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><span style="color: #3366ff;"><strong><em>cQ?不支持:</em></strong></span></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>业务下线Q业务不再需要,下线处理Q?/li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>版本初期不考虑该功能;</li><li style="list-style: inherit;"><strong><em>3Q?/em></strong>某端特定功能Qؓ了解x个问题,某端专门增加的一?api 供用;</li><li style="list-style: inherit;"><strong><em>4Q?/em></strong>pȝ能力不支持:HarmonyOS Next 没有该项能力?/li></ul><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">最l根据这些原则,我们定下来 V1 版本?WebView API 的需求范围、涉及业务方、改动方案。现在回惌v来,当时我们做的q一步是非常有必要的Q前期这些如果没有梳理清楚,后面非常容易造成沟通؜׃及媄响开发进度?/p><h3>6.3 关于性能</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">转{前端的页面主要是 Web 形态,Hybrid 场景占据多数。在q去的几q中Q我们围l?Hybrid 形态,摸烦Z一pd Web 面的优化方案。从基础的离U包Q到复杂的预渲染、预h{都有涉及。最l实C Hybrid 面?Native 面在电商场景下Q相差无几的体验?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">目前鸿蒙在这块优化上Q还都没来得及跟q这些优化手Dc这个也是后面要l箋的一个方向,最l要拉齐到和Android、iOS 一L性能优化体验?/p><h1>7、后l开发展?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">首个版本上线Q只是一个v炏V?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在业务上Q我们将不断的l追q?Android、iOS 中那些重要的模块和功能;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在开发工具体验和支持上,也逐渐补~失的能力,比如丰富的Native、WebView工兯力,q一步提升客L和前端在 HarmonyOS Next 下的开发体验?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在性能体验上,持箋的关注和跟进性能问题Q优?WebView 以及 Native 的用体验,提升 App 的流畅度和响应速度?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在创CQ我们将持箋探烦Q将更多?HarmonyOS Next 下的创新场景Q如元服务、意图推荐等{融入到转{ App 中,提升用户的购物用体验?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">要做的事情很多,我们会在后箋q代中逐步完善hq些能力Q敬h待?/p><h1>8、相兌?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[1] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">鸿蒙NEXT官方开发指?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[2] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">一q撸完百万行代码Q企业微信的全新鸿蒙NEXT客户端架构演q之?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[3] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">鸿蒙NEXT如何保证应用安全Q详解`蒙NEXT数字{֐和证书机?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[4] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">开源IM聊天E序HarmonyChatQ基于`蒙NEXT的WebSocket协议</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[5] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">微信U血鸿蒙版正式发布,295天走完微?4q技术之路!</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[6] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯框架MobileIMSDK的`蒙NEXT端详l介l?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[7] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯框架MobileIMSDK的`蒙NEXT端开发者手?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[8] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">转{q_IMpȝ架构设计与实?一)Q整体架构设?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[9] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">转{q_IMpȝ架构设计与实??Q详l设计与实现</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[10] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Web端IM聊天消息该不该用览器本地存储?一文即?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[11] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">手把手教你用网l编E抓包神器Wireshark</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[12] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">谈|页端IM技术及相关试Ҏ实践Q包括WebSocket性能试Q?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><br /><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Q本文已同步发布于:http://www.52im.net/thread-4820-1-1.htmlQ?/a></p><img src ="http://www.aygfsteel.com/jb2011/aggbug/451612.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jb2011/" target="_blank">Jack Jiang</a> 2025-04-23 10:50 <a href="http://www.aygfsteel.com/jb2011/archive/2025/04/23/451612.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一q撸完百万行代码Q企业微信的全新鸿蒙NEXT客户端架构演q之?/title><link>http://www.aygfsteel.com/jb2011/archive/2025/04/15/451610.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Tue, 15 Apr 2025 03:22:00 GMT</pubDate><guid>http://www.aygfsteel.com/jb2011/archive/2025/04/15/451610.html</guid><wfw:comment>http://www.aygfsteel.com/jb2011/comments/451610.html</wfw:comment><comments>http://www.aygfsteel.com/jb2011/archive/2025/04/15/451610.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jb2011/comments/commentRss/451610.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jb2011/services/trackbacks/451610.html</trackback:ping><description><![CDATA[     摘要: 本文׃业微信客L团队黄玮分nQ原?#8220;在流沙上{城Q企微`蒙开发演q?#8221;Q下文进行了排版优化和内容修订?、引a当企业微信团队在2024q启动`蒙Next版开发时Q我们面对的是双重难题:1Q在WXG团队模式下Q如何快速将数百万行U企业应用移植到全新操作pȝQ?Q在鸿蒙API q是Preview的初期,如何保持业务代码的稳定,在API快速更新的潮中岿然不动?DataLis...  <a href='http://www.aygfsteel.com/jb2011/archive/2025/04/15/451610.html'>阅读全文</a><img src ="http://www.aygfsteel.com/jb2011/aggbug/451610.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jb2011/" target="_blank">Jack Jiang</a> 2025-04-15 11:22 <a href="http://www.aygfsteel.com/jb2011/archive/2025/04/15/451610.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>鸿蒙NEXT如何保证应用安全Q详解`蒙NEXT数字{֐和证书机?/title><link>http://www.aygfsteel.com/jb2011/archive/2025/04/09/451609.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Wed, 09 Apr 2025 03:51:00 GMT</pubDate><guid>http://www.aygfsteel.com/jb2011/archive/2025/04/09/451609.html</guid><wfw:comment>http://www.aygfsteel.com/jb2011/comments/451609.html</wfw:comment><comments>http://www.aygfsteel.com/jb2011/archive/2025/04/09/451609.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jb2011/comments/commentRss/451609.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jb2011/services/trackbacks/451609.html</trackback:ping><description><![CDATA[     摘要: 本文q团技术团队张晨分享,原题“鸿蒙应用{֐实操及机制探I?#8221;Q下文进行了排版优化和内容修订?、引a华ؓ鸿蒙单框架操作系lHarmonyOS NEXT已于2024q?0?3日正式发布Release版。HarmonyOS NEXT仅支持`蒙原生应用,不再兼容安卓。本文对鸿蒙NEXT公开资料q行了深入分析和解读Q梳理了鸿蒙单框架应用的{֐机制Q拆解每一步的实操q程和背后的?..  <a href='http://www.aygfsteel.com/jb2011/archive/2025/04/09/451609.html'>阅读全文</a><img src ="http://www.aygfsteel.com/jb2011/aggbug/451609.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jb2011/" target="_blank">Jack Jiang</a> 2025-04-09 11:51 <a href="http://www.aygfsteel.com/jb2011/archive/2025/04/09/451609.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>全民AI时代Q大模型客户端和服务端的实时通信到底用什么协议?http://www.aygfsteel.com/jb2011/archive/2025/03/27/451607.htmlJack JiangJack JiangThu, 27 Mar 2025 07:14:00 GMThttp://www.aygfsteel.com/jb2011/archive/2025/03/27/451607.htmlhttp://www.aygfsteel.com/jb2011/comments/451607.htmlhttp://www.aygfsteel.com/jb2011/archive/2025/03/27/451607.html#Feedback0http://www.aygfsteel.com/jb2011/comments/commentRss/451607.htmlhttp://www.aygfsteel.com/jb2011/services/trackbacks/451607.html阅读全文

Jack Jiang 2025-03-27 15:14 发表评论
]]>
零基IM开发入??Q什么是IMpȝ的端到端加密Q?/title><link>http://www.aygfsteel.com/jb2011/archive/2025/03/20/451601.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Thu, 20 Mar 2025 03:11:00 GMT</pubDate><guid>http://www.aygfsteel.com/jb2011/archive/2025/03/20/451601.html</guid><wfw:comment>http://www.aygfsteel.com/jb2011/comments/451601.html</wfw:comment><comments>http://www.aygfsteel.com/jb2011/archive/2025/03/20/451601.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jb2011/comments/commentRss/451601.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jb2011/services/trackbacks/451601.html</trackback:ping><description><![CDATA[<blockquote style="background-image: none; border-top: none; border-right: none; border-bottom: none; border-left-width: 3px; border-left-color: #e2dfdf; margin-right: 0px; margin-left: 0px; background-color: #eeeeee; width: 840.95px; color: #555555; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;"><p style="margin-top: 10px; margin-bottom: 10px;">本文由夏冰Y件cc分nQ下文进行了排版和内容优化?/p></blockquote><h1>1、引a</h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">本文接上?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">什么是IMpȝ的消息时序一致性?</a>》,<strong>本篇通俗易懂地讲解IMpȝ中的端到端加密原理,Z降低阅读门槛Q相关的技术概念会提及但不深入展开</strong>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">IMx通讯pȝ的技术本质是“x消息技?#8221;Q是互联|实时互动场景的底层架构Q包括聊天、直播、在U客服等业务领域在内Q所有需要实时互动、高实时性的场景Q都需要用到IM技术。而ؓ了让x通讯更安全,高安全场景下的IMpȝ通常会用端到端加密技术进行通讯加密。下面我们就来了解一下端到端加密技术在IMpȝ中的应用?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101702443-1509221184.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /><p style="margin-top: 10px; margin-bottom: 10px;"><strong>技术交:</strong></p><div><div><div><p style="margin-top: 10px; margin-bottom: 10px;">- Ud端IM开发入门文章:?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">新手入门一就够:从零开发移动端IM</a>?/p><p style="margin-top: 10px; margin-bottom: 10px;">- 开源IM框架源码Q?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">https://github.com/JackJiang2011/MobileIMSDK</a>Q?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">备用地址Ҏ</a>Q?/p></div></div></div><p style="margin-top: 10px; margin-bottom: 10px;"><a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">Q?/a><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">本文已同步发布于Qhttp://www.52im.net/thread-4792-1-1.html</a><a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">Q?/a></p></div><h1>2、系列文?/h1><ol style="padding-left: 40px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基IM开发入?一)Q什么是IMpȝQ?/a>?/li><li style="list-style: inherit;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基IM开发入??Q什么是IMpȝ的实时性?</a>?/li><li style="list-style: inherit;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基IM开发入??Q什么是IMpȝ的可靠性?</a>?/li><li style="list-style: inherit;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基IM开发入??Q什么是IMpȝ的消息时序一致性?</a>?/li><li style="list-style: inherit;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基IM开发入??Q什么是IMpȝ的端到端加密Q?/a>Q?span style="color: #ff0000;"><strong>* 本文</strong></span>Q?/li><li style="list-style: inherit;">《零基础IM开发入??Q什么是IMpȝ的的心蟩机制Q?nbsp;(E后发布)?/li><li style="list-style: inherit;">《零基础IM开发入??Q如何理解ƈ实现IMpȝ消息未读敎ͼ (E后发布)?/li><li style="list-style: inherit;">《零基础IM开发入??Q如何理解ƈ实现IMpȝ的多端消息O游? (E后发布)?/li></ol><h1>3、网l通讯数据加密?个层?/h1><h3>3.1 概述</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">一般的数据加密可以在通信?个层ơ来实现Q链路加密、节点加密和端到端加密?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101711618-1579881729.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><h3>3.2 链\加密</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">对于在两个网l节炚w的某一ơ通信链\Q链路加密能为网上传输的数据提供安全保证。对于链路加?又称在线加密)Q所有消息在被传输之前进行加密,在每一个节点对接收到的消息q行解密Q然后先使用下一个链路的密钥Ҏ息进行加密,再进行传输?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在到辄的地之前Q一条消息可能要l过许多通信链\的传输。由于在每一个中间传输节Ҏ息均被解密后重新q行加密Q因此,包括路由信息在内的链路上的所有数据均以密文Ş式出玎ͼq样Q链路加密就掩盖了被传输消息的源点与l点。由于填充技术的使用以及填充字符在不需要传输数据的情况下就可以q行加密Q这使得消息的频率和长度Ҏ得以掩盖,从而可以防止对通信业务q行分析?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>相关文章推荐阅读Q?/strong>?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">IM聊天pȝ安全手段之通信q接层加密技术?/a>?/p><h3>3.3 节点加密</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">管节点加密能给|络数据提供较高的安全性,但它在操作方式上与链路加密是cM的:两者均在通信链\上ؓ传输的消息提供安全性,都在中间节点先对消息q行解密Q然后进行加密。因Ҏ有传输的数据q行加密Q所以加密过E对用户是透明的。然而,与链路加密不同,节点加密不允许消息在|络节点以明文Ş式存在,它先把收到的消息q行解密Q然后采用另一个不同的密钥q行加密Q这一q程是在节点上的一个安全模块中q行?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">节点加密要求报头和\׃息以明文形式传输Q以便中间节点能得到如何处理消息的信息,因此q种Ҏ对于防止d者分析通信业务是脆q?/p><h3>3.4 端到端加?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">端到端加密允许数据在从源点到l点的传输过E中始终以密文Ş式存在。采用端到端加密(又称q加密或包加密)Q消息在被传输时到达l点之前不进行解密,因ؓ消息在整个传輸过E中均受C护,所以即使有节点被损坏也不会使消息泄霌Ӏ?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">端到端加密系l的h便宜些,q且与链路加密和节点加密相比更可靠,更容易设计、实现和l护。端到端加密q避免了其它加密pȝ所固有的同步问题,因ؓ每个报文包均是独立被加密的,所以一个报文包所发生的传输错误不会媄响后l的报文包。端到端加密pȝ通常不允许对消息的目的地址q行加密Q这是囚为每一个消息所l过的节炚w要用此地址来确定如何传输消息。由于这U加密方法不能掩盖被传输消息的源点与l点Q因此它对于防止d者分析通信业务是脆q?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>没有使用端到端加密时的通信原理图(各个环节都存在泄密的可能Q:</strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101718386-1458871471.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>使用端到端加密后的通信原理图(除了发送者和接收者,其它环境都是密文状态)Q?/strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101726627-375512300.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><h1>4、IMpȝ中的端到端加密原?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在IMpȝ中,当用户A发送消息给用户BӞIMpȝ会生成一对公钥和U钥Qƈ公钥发送给用户B。用户A使用用户B的公钥对消息q行加密Q然后将加密后的消息发送给用户B?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101732145-1746427954.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在用户B接收到消息后Q用自qU钥Ҏ息进行解密,从而获取明文内宏V由于私钥只有用户B拥有Q因此除了用户B之外QQ何h都无法解密消息?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>没有使用端到端加密时的聊天消息存在诸多风险:</strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101737968-2095346056.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>使用了端到端加密后的聊天安全多了:</strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101743554-931926986.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><h1>5、IMpȝ使用端到端加密的好处</h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>数据安全性:</strong>在IMpȝ中,端到端加密可以确保消息在传输q程中始l保持加密状态,防止黑客和第三方H取用户的通信内容?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>隐私保护Q?/strong>׃消息内容只有通信双方能够解密和阅读,即是IMpȝ应用自n也无法获取明文内宏V这意味着用户的隐U得C最大程度的保护?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>抗窃听:</strong>IMpȝ使用端到端加密技术,使得H听者无法获取通信内容Q从而有效防止了H听行ؓ的发生?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101749184-956518953.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><h1>6、IMpȝ使用端到端加密的意义</h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">׃在数据传输到服务器之后,M有权讉K此服务器的hQ包括员工、供应商及其他有关h员(甚至是黑客)Q都有可能读取到用户的数据?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">所以,使用端到端加密技术主要有以下意义Q?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>1Q?/em></strong><span style="color: #800000;">保护个h隐私</span>Q在信息时代Q个人隐U面临着来大的威胁。在IMpȝ中用端到端加密可以有效保护了用L通信内容Q确保个人隐U不被R犯?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>2Q?/em></strong><span style="color: #800000;">防止数据泄露</span>Q许多用户在C交软g中分享了大量的个Z息和敏感数据。而IMpȝ中的端到端加密就可以保q些数据在传输过E中不会被窃取,从而避免了数据泄露的风险?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>3Q?/em></strong><span style="color: #800000;">抵M|络d</span>Q黑客和|络犯罪分子l常利用|络漏洞和弱Ҏd用户的通信。IMpȝ中的端到端加密可以有效防止这些攻击,保护用户的通信安全?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>4Q?/em></strong><span style="color: #800000;">l护C交关系</span>Qh们越来越依赖C交应用来保持联pd交流。IMpȝ使用端到端加密可以得用戯够放心地分nU密信息Q维护社交关pȝ同时保护了个人隐U?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250320101755218-1583481138.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><h1>7、IMpȝ使用端到端加密的不</h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>通讯效率低:</strong>׃端对端加密需要对通讯数据q行加密和解密,因此可能会导致通信效率较低?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>需双向支持Q?/strong>端对端加密需要发送方和接收方都需要支持该技术,否则将无法实现端对端加密通信?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>安全性问题:</strong>虽然端对端加密可以防止中间hdQ但如果黑客能够获得了私钥或公钥Q那么他们也能够L地获取到通信数据?/p><h1>8、g伔R?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">本文内容主要是面向即旉讯技术的初学者以及品经理,所以相关的技术概念都没有深入探讨Q感光趣的可以l深入阅L整理的以下几资料?/p><ol style="padding-left: 40px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">IM聊天pȝ安全手段之通信q接层加密技?/a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">IM聊天pȝ安全手段之传输内容端到端加密技?/a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Ud端安全通信的利?#8212;—端到端加密(E2EEQ技术详?/a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">q实旉视频聊天中端到端加密QE2EEQ的工作原理</a></li></ol><h1>9、参考资?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[1] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">|络~程懒h入门(?Q快速理解TCP协议一就?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[2] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯初学者必知必会的20个网l编E和通信安全知识?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[3] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Z么要用HTTPSQ深入浅出,探密短连接的安全?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[4] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">理论联系实际Q一套典型的IM通信协议设计详解Q含安全层设计)</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[5] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">微信C代通信安全解决ҎQ基于TLS1.3的MMTLS详解</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[6] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Ud端安全通信的利?#8212;—端到端加密(E2EEQ技术详?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[7] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">常用加解密算法与通讯安全讲解</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[8] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">通俗易懂Q一掌握即旉讯的消息传输安全原?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[9] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">ZNetty的IM聊天加密技术学习:一文理清常见的加密概念、术语等</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[10] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">手把手教你ؓZNetty的IM生成自签名SSL/TLS证书</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[11] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">微信技术分享:揭秘微信后台安全特征数据仓库的架构设?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[12] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯初学者必知必会的20个网l编E和通信安全知识?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Q本文已同步发布于:http://www.52im.net/thread-4792-1-1.htmlQ?/a></p><img src ="http://www.aygfsteel.com/jb2011/aggbug/451601.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jb2011/" target="_blank">Jack Jiang</a> 2025-03-20 11:11 <a href="http://www.aygfsteel.com/jb2011/archive/2025/03/20/451601.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>支持百万大群聊的Web端IM架构设计与实?/title><link>http://www.aygfsteel.com/jb2011/archive/2025/03/13/451598.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Thu, 13 Mar 2025 05:36:00 GMT</pubDate><guid>http://www.aygfsteel.com/jb2011/archive/2025/03/13/451598.html</guid><wfw:comment>http://www.aygfsteel.com/jb2011/comments/451598.html</wfw:comment><comments>http://www.aygfsteel.com/jb2011/archive/2025/03/13/451598.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jb2011/comments/commentRss/451598.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jb2011/services/trackbacks/451598.html</trackback:ping><description><![CDATA[     摘要: 本文由vivo互联|服务器团队Cai Linfeng分nQ来自公众号“ vivo互联|技?#8221;Q原?#8220;百万U群聊的设计实践”Q下文进行了排版优化和内容修订?、引a现在IM聊产品多种多样Q有国民U的微信、QQQ企业的钉钉、飞书,q有许多公司内部的IM工具Q这些都是以客户端ؓ主要载体。而且聊人数通常都是有限Ӟ微信正常hC限是500QQQ200...  <a href='http://www.aygfsteel.com/jb2011/archive/2025/03/13/451598.html'>阅读全文</a><img src ="http://www.aygfsteel.com/jb2011/aggbug/451598.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jb2011/" target="_blank">Jack Jiang</a> 2025-03-13 13:36 <a href="http://www.aygfsteel.com/jb2011/archive/2025/03/13/451598.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>视频直播技术干?十三)QB站实时视频直播技术实践和韌频知识入?/title><link>http://www.aygfsteel.com/jb2011/archive/2025/03/06/451591.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Thu, 06 Mar 2025 03:46:00 GMT</pubDate><guid>http://www.aygfsteel.com/jb2011/archive/2025/03/06/451591.html</guid><wfw:comment>http://www.aygfsteel.com/jb2011/comments/451591.html</wfw:comment><comments>http://www.aygfsteel.com/jb2011/archive/2025/03/06/451591.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jb2011/comments/commentRss/451591.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jb2011/services/trackbacks/451591.html</trackback:ping><description><![CDATA[<blockquote style="background-image: none; border-top: none; border-right: none; border-bottom: none; border-left-width: 3px; border-left-color: #e2dfdf; margin-right: 0px; margin-left: 0px; background-color: #eeeeee; width: 927.35px; color: #555555; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;"><p style="margin-top: 10px; margin-bottom: 10px;">本文由B端技术中心资深开发工E师马家忆分享,原题“B站在实时韌频技术领域的探烦与实?#8221;Q下文进行了排版和内容优化?/p></blockquote><h1>1、引a</h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">直播行业从传l的׃直播发展到教育直播、电商直播等形式Q生了很多新的玩法。传l的直播是一位主播展C才艺,观众通过弹幕、送礼物等方式q行互动。随着|络质量不断地提高,用户也对直播q_产生的新的要求,实时互动直播的场景就出现了,观众可以同时观看多位L之间互动的画面,让直播间的气氛更好。B站直播的q麦PK、视频连U业务就提供了这个能力。主播看到的是对方主播实时的(延迟400ms以内Q,而观众看到的?#8220;准实?#8221;的流Qgq?~5s左右Q?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>本文讲述搭徏q样一套最新流行的实时视频直播pȝ需要了解的背景知识以及pȝ的整体架构,希望对大家有帮助?/strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110047146-1448646015.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><p style="margin-top: 10px; margin-bottom: 10px;"><strong>技术交:</strong></p><div><div><div><p style="margin-top: 10px; margin-bottom: 10px;">- Ud端IM开发入门文章:?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">新手入门一就够:从零开发移动端IM</a>?/p><p style="margin-top: 10px; margin-bottom: 10px;">- 开源IM框架源码Q?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">https://github.com/JackJiang2011/MobileIMSDK</a>Q?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">备用地址Ҏ</a>Q?/p><p style="margin-top: 10px; margin-bottom: 10px;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Q本文已同步发布于:http://www.52im.net/thread-4785-1-1.htmlQ?/a></p></div></div></div></div><h1>2、系列文?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>本文是系列文章中的第 <span style="color: #ff0000;"><em>13</em> </span>,本系列ȝ录如下:</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干?一)Q揭U百万_丝互动的Facebook实时视频直播</a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??QP2P技术如何将实时视频直播带宽降低75%Q?/a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??Q实时直播答题系l的实现思\与技术难点分?/a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??Q首ơ披露快手是如何做到百万观众同场看直播仍能秒开且不卡顿的?</a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??Q七牛云使用QUIC协议实现实时视频直播0卡顿</a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??Q新微博实时直播答题的百万高ƈ发架构实?/a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??Q实时视频直播首屏耗时400ms内的优化实践</a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??Q淘宝高清、低延时的实时视频直播技术解?/a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??Q千万直播pȝ后端架构设计的方斚w?/a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干??Q一文读懂主视频直播系l的推拉架构、传输协议等</a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干?十一)Q超低g时视频直播技术的演进之\</a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干?十二)Q从入门到放弃,快速学习Android端直播技?/a>?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干?十三)QB站实时视频直播技术实践和韌频知识入?/a>》(<span style="color: #ff0000;"><strong><em>* 本文</em></strong></span>Q?/p><h1>3、关于作?/h1><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110229436-320739940.png" alt="" style="border: 0px; max-width: 100%; height: auto !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>马家忆:</strong>B端技术中心资深开发工E师?/p><h1>4、实旉视频关键技术概q?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">??搭徏一套实旉视频pȝq支撑现有的业务Q如果没有接触过q方面的东西会感觉无从下手?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">我们可以看到Q?996qIETF推ZRTP协议用于实时韌频传输,2011qGoogle推出了WebRTC用于|页端实旉视频通话Q见?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">了不LWebRTCQ生态日完善,或将实时韌频技术白菜化</a>》)?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">从这些现有的协议和项目中Q我们可以发现实旉视频技术的关键点,评估自n现有的基lg支持情况q结合业务场景寻N合自己的解x案?/p><h1>5、关键技?Q传输协?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">RTP协议QReal-time Transport ProtocolQ定义了在互联网上传输实旉视频数据的标准格式,属于应用层协议?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">RFC 3550</a>描述RTP协议的传输层主要使用UDPQ?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">RFC 4571</a>描述了RTP协议的TCP传输方式?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>在我们的实时韌频场景中应当优先选择UDPQ理由如下:</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>1Q?/em></strong>TCP保证数据的可靠性和序性。TCP的超旉传策略ؓ了保证通用和公qI相对比较保守Q重传超时时_RTOQ可能会变的很大。假如中途丢׃个包Q后l的包即使先到达也要~存h{待重传完成以后才能送到应用层。在|络状况不佳的情况下Q用TCP传输会生较大的延迟Q?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>2Q?/em></strong>UDP允许数据包丢失、ؕ序和重复。即使数据丢׃不会d接收~冲区等待重传,q就为实时性提供了保障。在上层的RTP协议中,协议头部包含了时间戳和序列号Q可以对数据包进行重排和丢弃Q解决了乱序和重复的问题。如果接收端监测C包,q且丢失的包是必要的且无法恢复,则发送NACK消息通知发送端重传Q下一节会详细探讨q个话题Q?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">UDP虽然在低延迟领域上有压倒性的优势Q但是用户侧有可能存在防火墙拦截所有的UDP包。考虑到在|络环境_好的情况下用TCP也能辑ֈ不错的效果,因此我们做了一个降U策略,优先使用UDPQ当且仅当UDP不通的时候用TCP?/p><h1>6、关键技?Q丢包补?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">前面讲到我们的传输层协议优先选择UDPQ那么就需要引入一些机制解决丢包问题?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">前向U错FECQForward Error CorrectionQ指的是发送端发送原始数据的同时附加部分冗余的信息,如果接收端检到原始数据丢失则尝试用冗余的信息q行恢复。发送端发送n个数据包Q同时根据原始数据生成k个冗余的数据包,n+k个数据包发送出去,接收端只要收到至n个数据包可以得到全部的原始数据?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">FEC法的关键在于异或。异?Exclusive OR)是一个数学运符Q数学符号ؓ“⊕”Q两ҎD{换成二进制按位运,相同时ؓ0Q不同时??/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">以一阶冗余算法ؓ例,n个数据包生成1个冗余包Q发送n+1个数据包。我们发送三个数值分别ؓa、b、cQ生成冗余数据x=a ⊕b ⊕ c一起发送。假如数值b在传输中丢失了,计算a ⊕c ⊕ x卛_得到b?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在实际应用中QFEC没有q么单,WebRTC实现了UlpFEC和FlexFECQUlpFEC可以针对数据包的重要E度实施不同E度的保护以充分利用带宽QFlexFECq支持对列做冗余Q同时WebRTC默认的音频编码器Opus本n支持FEC?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">前向U错适合量随机丢包的场景,可以无视|络延迟旉Q但是增加了带宽消耗?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">后向U错包括ARQQAutomatic Repeat RequestQ和PLCQPacket Loss ConcealmentQ。ARQ指的是接收端到数据丢失的时候发送NACK报文h发送端重传Q适合H发大量丢包的场景,没有额外的带宽消耗,但是时效性取决于RTTQ如果存在很多接收端q要考虑避免NACK风暴造成雪崩。PLC用于音频Q当数据~失时用模型根据前后数据预丢q数据?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">MQ?strong>前向U错和后向纠错各有优~点Q需要搭配用?/strong></p><h1>7、关键技?Q流量控?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">量控制指的是根据网l状늚波动估算可用带宽Q根据带宽的变化自动调节韌频码率和发送速率。当|络质量变差的时候迅速降低数据量以确保实时性,|络较好时则慢慢提升数据量带来更清晰的画面。在WebRTC中提供了优秀的Google Congestion Control法Q包括基于gq的评估和基于丢包率的评伎ͼ取两U评估方式的最g为目标带宽通知~码器和数据发送模块?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">Z延迟的评估算法包括Transport-CC和Goog-REMBQ目前最新版的WebRTC默认使用的是Transport-CC。Transport-CC在发送端q行带宽评估Q接收端通过TransportFeedback RTCP包向发送端反馈每个RTP包的到达旉Q发送端在一个时间窗口内计算每个RTP包到达时间与发送时间之差,通过Trendline滤L器处理后预测|络状况。假设我们当前处于Hold状态,如果到|络状态ؓOverUseQ此时应该减数据量Q变更ؓDecrease状态;如果到|络状态ؓNormalQ此时可以尝试增加数据量Q变更ؓIncrease状态?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110239825-1414984818.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>Z丢包的评估算法是当网l突发大量丢包时的兜底策略:</strong></p><ul style="margin-left: 30px; padding-left: 0px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><strong><em>1Q?/em></strong>如果丢包率在2%以下的时候说明网l质量好Q目标带宽增?%Q?/li><li style="list-style: inherit;"><strong><em>2Q?/em></strong>如果丢包率在?%~10%说明当前发送数据的带宽和网l质量相匚w可以保持不变Q?/li><li style="list-style: inherit;"><strong><em>3Q?/em></strong>如果丢包率大?0%说明|络质量差,目标带宽减小?1-丢包?0.5)* 当前带宽?/li></ul><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110249176-1469313693.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><h1>8、关键技?Q数据缓?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">如果我们只考虑实时性,那么收到数据q刻解码ƈ渲染必然是最好的选择Q但是网lƈ不稳定,延迟、ؕ序、丢包、重复包都有可能发生。如果采用上面的{略Q音频可能因为网l的抖动变的断断l箋Q视频可能因Z包导致缺参考从而出现黑屏或花屏Q所以有必要引入一个缓冲区Q增加一点可以接受的延迟来保证用户体验?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在WebRTC中,视频包会被放入JitterBuffer模块q行处理QJitterBuffer会进行视频包的排序、组装成完整的、确保参考有效Q然后把数据送到解码器。同ӞҎ|络状况自适应地调节缓冲区的长度。音频包会被攑օNetEQ中,它维护了音频的缓冲区Q同时负责将音频同步到视频。我们做<strong>播放器一般都是以音频的时间ؓ基准同步视频Q但是WebRTC刚好相反Q它是以视频为基准的?/strong>当音频数据堆U的时候加速音频播放,音频数据不的时候降低速度把音频拉ѝ?/p><h1>9、关键技?Q回声消?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">在语音通话的场景中Q麦克风采集到的声音发送给q端Q远端的扬声器播攑և来以后又被远端的麦克风采集到q个声音q传送回来,q样讲话的h会感觉到有回壎ͼ影响体验?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">WebRTC提供了回声消除算法AECQ时延估计(Delay EstimationQ模块找到扬声器信号和麦克风信号的时ӞU性自适应滤L器(Linear Adaptive FilterQ参考扬声器信号估算回声信号q将其剪去,最后通过非线性处理(Nonlinear ProcessingQ模块消除残留的回声?/p><h1>10、关键技?Q最优\?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">实时韌频对|络的要求非帔RQ如果通话双方距离很远Q那么通话质量是很难保证的。城市A的设备给城市D的设备发送数据,直接发送未必是最优的选择Q从城市B和城市C中{一下有可能更快?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">理想的解x案是在全球部|加速节点,用户p接入。根据加速节点之间的实时|络质量探测数据Q找C条最优传输\径,避开|络的拥c?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110258131-1078418235.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><h1>11、开源音视频框架WebRTCq?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">刚才介绍了实旉视频pȝ实现q程中所需的关键技术,多次提到了WebRTC。显Ӟ对于l大多数团队来说Q这些内容如果全部自ȝ发几乎是不可能的事情Q而我们站在WebRTC的基上去设计自己的系l是较ؓ明智的选择?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">WebRTC的代码非常复杂,惌把它搞清楚是一仉常困隄dQ我W一ơ看到WebRTC的代码根本就不知道从哪里下手?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">q运的是QWebRTC官方提供了架构图Q可以先帮助我们对它q行一个宏观的了解?/p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110307602-825327680.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>WebRTC整体架构大概可以分ؓ接口层、会话层、引擎层和设备I/O层:</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>1Q?/em></strong>接口层包括Web API和WebRTC C++ APIQWeb APIlWeb开发者提供了JavaScript接口Q这样Web端就具备了接入WebRTC的能力;WebRTC C++ API面向的是览器开发者,让浏览器开发商具备集成WebRTC的能力。当ӞWebRTC C++ API也可以用于Native客户端接入;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>2Q?/em></strong>会话层主要包含信令相关的逻辑Q比如媒体协商,P2Pq接理{;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>3Q?/em></strong>引擎层是WebRTC最核心的功能,包括音频引擎、视频引擎和传输模块。音频引擎包含音频编解码器(OpusQ、NetEQ和著名的3AQ回声消除、自动增益、降噪)法Q视频引擎包括视频编解码器(VP8、VP9、H264Q、JitterBufer和图像增强(降噪Q算法;传输模块包含SRTP、多路复用和P2P模块Q?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong><em>4Q?/em></strong>讑֤I/O层主要和g交互Q包括音视频采集和渲染,以及|络I/O?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">上面一节描q的实时韌频关键技术中QWebRTC实现了除“最优\?#8221;之外的全部内宏VWebRTC几乎每个模块都是可以按需替换的,便于我们增加定制的内宏V我们可以根据实际需求决定如何用WebRTCQNative客户端可以通PeerConnection接口接入Q服务端拿到RTP/RTCP包以后完全可以直接调用引擎层处理拿到最l的YUV和PCM数据Q甚臛_把WebRTC内部模块抠出来用在自qpȝ上也是没问题的?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>更多相关资料可阅读:</strong></p><ol style="padding-left: 40px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基入门Q基于开源WebRTCQ从0?实现实时韌频聊天功?/a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">实时韌频入门学习:开源工EWebRTC的技术原理和使用析</a></li><li style="list-style: inherit;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基快速入门WebRTCQ基本概c关键技术、与WebSocket的区别等</a></li></ol><h1>12、B站视频直播系l架?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">我们回到B站的q麦PK业务场景Q两位主播进行互动PKQ同时大量观众在直播间观看PK的过E?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">昄Q两位主播通话要求低gq,必须使用实时韌频系l交互;而观众观看直播的延迟要求相对没那么严|可以采取传统直播的模式,通过RTMP或者SRT推流到CDNQ用户从CDN拉流?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">然后我们要思考两个问题?/p><h3>12.1 问题1Q主播之间的韌频通话是采用P2Pq是服务器中转?</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>首先对P2P和服务器中{两种Ҏ做个ҎQ?/strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110320794-1170299880.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">对于P2PҎ来说Q只需要部|STUN和TURN服务器,如果成功建立P2Pq接那么后箋媒体数据传输׃需要经q服务器Q所以具有成本优ѝ然而,P2P的缺点也很明显,如果打洞p|q是需要TURN服务器中转,且徏立连接的q程耗时较高Q用户之间距较q的情况下网l质量不可控Q而且现有的第三方|络加速服务基本上都不支持P2P?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">我们q里选择服务器中转的ҎQ因为实旉视频本n对网l的要求比较高,不会讄q高的码率,所以网l传输的数据量是可控的,成本能够接受。而且我们的实旉视频数据要对接AI审核Q还要实现服务器hQ这是P2PҎ做不到的?/p><h3>12.2 问题2Q推送给观众的流到CDNQ这个工作放在主播客Lq是服务器?</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">两位LPK对应的是两\,观众只从CDN拉一路流Q所以必L个地方做h。这里的h指的是把两位L的视频进行拼接、音频进行؜合,然后打包成一路流。主播客L能收到对方的,可以和自q做hQ在前面提到的服务器中{Ҏ中,服务器有双方的流Q同样也可以完成h?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>我们先对比一下两U方案的优劣Q?/strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110330780-699765721.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">服务器进行؜需要先解码再编码,q需要消耗大量计资源,所以成本很高;L客户端进行؜需要额外增加一路流的编码和上传Q对讑֤性能和上行带宽来说也是很大的挑战?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">L客户端需要等待服务器把对方的发送过来才能؜,所以从延迟的角度来看服务器hE微占据优势Q不q这个gq相比CDN的gq可以忽略不计。如果后期对通话质量要求变高Q主播的讑֤性能和上行带宽跟不上Q我们可以很Ҏ增加服务器来扩展计算资源和带宽,所以在可扩展性方面服务器h胜出?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">另外Q当L从正常直播切换到q麦PK状态的时候,采用服务器؜必d把直播的停掉再由服务器接管Q中间的旉差可能会产生卡顿或黑屏媄响观众体验,而主播客Lh可以做到无缝切换?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">所以,q两U方案各有优~点Q我们采取折L办法Q如果主播的讑֤负蝲较低且上行带宽比较充I优先采用L客户端؜的方式Q否则降Uؓ服务器؜?/p><h3>12.3 开始架构设?/h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">上面两个问题分析清楚了,可以开始设计了?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><strong>q是我们的系l整体架构:</strong></p><div style="font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><img src="https://img2024.cnblogs.com/blog/1834368/202503/1834368-20250306110340703-427233218.png" alt="" style="border: 0px; max-width: 100%; height: auto !important; cursor: zoom-in; transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1) 0s !important;" /></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">rtc-service主要提供信o、频道管理、主播管理、公有云上媒体服务器集群的健h查和节点分配、同步主播状态到业务服务器、记录通话水?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">rtc-job是对rtc-service的补充,定期查当前在U主播的状态,发现L异常下线时触发兜底逻辑?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">rtc-router负责收发L的音视频数据。主播可以收到同一个频道内其他人的韌频流。如果需要服务器hQ则讉K注册中心q用Google的有界负载一致性哈希算法(Consistent Hashing with Bounded LoadsQ选取rtc-mixer节点Qƈ往对应节点推送主播的韌频流?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">rtc-mixer负责hQ根据需求拼接画面和混音Q然后推送到CDNQ观众通过CDN拉流?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">L的客Lq没有直接向rtc-router发送数据,而是通过W三方的四层加速网l{发。我们前面提C“最优\?#8221;的概念,W三方的四层加速服务可以让用户接入最q的加速节点,然后L最优\径把数据转发到我们的公有云节炏V客L只能看到W三方的加速节点IPQ看不到我们公有云媒体服务器的IPQ这在一定程度上可以防止服务器遭到攻击;其次Q我们可以在保证异地多活的前提下让公有云集群相对比较集中Q节省成本?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">服务的可用性和定w性也是一个很重要的问题,假如在主播PK卛_胜利的时L务出现故障,弹出"PK异常l止请重新再?Q这很o人绝望。我们不仅要保证服务可用Q还要尽最大可能保证服务出现故障时减小对用L影响Q让程能够C厅R接下来讨论pȝ中每个风险模块ؓ了实现这个目标所采取的措施:</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">四层加速网l故障。这个属于第三方厂商提供的服务,每个厂商提供的接入方式大同小异,基本上就是附加的header有差别,所以同时对接多家厂商对客户端来说是很容易做到的。客Lq行q通性检查,只要存在臛_一家厂商的服务可用Q就不会影响业务?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">公有云上的rtc-router和rtc-mixer故障。在公有云上部v服务Q尽量要多厂商、多区域部vQ防止单机房整体宕机。我们同样准备了多个集群Q每个集都部v了多台rtc-router、rtc-mixer和ZooKeeperQ单个集可以独立工作,如果单个集群不可用或者负载达C限则会被熔断。核心机房的rtc-service会对公有云上的集进行健h查,如果rtc-router宕机Qrtc-service会通过信o通道通知客户端切换到同集中其他服务器,当同集群没有可用机器时则切换集群。如果rtc-mixer宕机Qrtc-router会通过ZooKeeper重新选择一台接؜Q务?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">核心机房的rtc-service和rtc-job故障。这部分内容和B站大部分核心服务部v在同L集群Q复用了B站比较成熟的高可用架构。这部分内容可以参考其他文章,q里不再赘述?/p><h1>13、本文小l?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">如果我们把实旉视频技术比作一座富丽堂皇的城池Q这文章只能带领大家来到城门口。我们也不会停止探烦的脚步。希望大家读到这里能够有所收获Q如有疏漏,Ƣ迎批评指正?/p><h1>14、参考资?/h1><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[1] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">实时语音通讯的回韛_回音消除概述</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[2] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">实时语音通讯的回x?技术详?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[3] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">实时语音通讯丢包补偿技术详?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[4] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基Q史上最通俗视频~码技术入?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[5] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">IM实时韌频聊天时的回声消除技术详?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[6] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">学习RFC3550QRTP/RTCP实时传输协议基础知识</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[7] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">ZRTMP数据传输协议的实时流媒体技术研IӞ论文全文Q?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[8] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">爱奇艺技术分享:L诙谐Q讲解视频编解码技术的q去、现在和来</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[9] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基入门Q实旉视频技术基知识全面盘点</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[10] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">实时韌频面视必备:快速掌?1个视频技术相关的基础概念</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[11] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基入门Q基于开源WebRTCQ从0?实现实时韌频聊天功?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[12] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">实时韌频入门学习:开源工EWebRTC的技术原理和使用析</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[13] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">零基快速入门WebRTCQ基本概c关键技术、与WebSocket的区别等</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[14] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Ud端实旉视频直播技术详解(五)Q推和传输</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[15] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Ud端实旉视频直播技术详解(六)Qgq优?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[16] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">实时视频直播客户端技术盘点:Native、html5、WebRTC、微信小E序</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[17] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">谈开发实时视频直播^台的技术要?/a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;">[18] <a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">视频直播技术干货:一文读懂主视频直播系l的推拉架构、传输协议等</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #ffffff;"><a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">Q本文已同步发布于:http://www.52im.net/thread-4785-1-1.htmlQ?/a></p><img src ="http://www.aygfsteel.com/jb2011/aggbug/451591.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jb2011/" target="_blank">Jack Jiang</a> 2025-03-06 11:46 <a href="http://www.aygfsteel.com/jb2011/archive/2025/03/06/451591.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>x通讯初学者必知必会的20个网l编E和通信安全知识?/title><link>http://www.aygfsteel.com/jb2011/archive/2025/02/27/451588.html</link><dc:creator>Jack Jiang</dc:creator><author>Jack Jiang</author><pubDate>Thu, 27 Feb 2025 05:04:00 GMT</pubDate><guid>http://www.aygfsteel.com/jb2011/archive/2025/02/27/451588.html</guid><wfw:comment>http://www.aygfsteel.com/jb2011/comments/451588.html</wfw:comment><comments>http://www.aygfsteel.com/jb2011/archive/2025/02/27/451588.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jb2011/comments/commentRss/451588.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jb2011/services/trackbacks/451588.html</trackback:ping><description><![CDATA[     摘要: 本文引用自公众号“计算U学与信息化”Q原?#8220;q维必知?0个网l安全知识点!”Q下文进行了排版和内容优化?、引ax通讯IM应用开发的初学者很Ҏq失在网l编E的复杂性以及通信安全的各U概念里Q本文不涉及深度理论知识Q尽量通过一句话或几句话让你快速了?0个相关的|络~程和通信安全知识点,希望能助你愉快地开始即旉讯应用开发。技术交:- Ud端I...  <a href='http://www.aygfsteel.com/jb2011/archive/2025/02/27/451588.html'>阅读全文</a><img src ="http://www.aygfsteel.com/jb2011/aggbug/451588.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jb2011/" target="_blank">Jack Jiang</a> 2025-02-27 13:04 <a href="http://www.aygfsteel.com/jb2011/archive/2025/02/27/451588.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>探讨l合加密法在IM中的应用http://www.aygfsteel.com/jb2011/archive/2025/02/26/451586.htmlJack JiangJack JiangWed, 26 Feb 2025 03:32:00 GMThttp://www.aygfsteel.com/jb2011/archive/2025/02/26/451586.htmlhttp://www.aygfsteel.com/jb2011/comments/451586.htmlhttp://www.aygfsteel.com/jb2011/archive/2025/02/26/451586.html#Feedback0http://www.aygfsteel.com/jb2011/comments/commentRss/451586.htmlhttp://www.aygfsteel.com/jb2011/services/trackbacks/451586.html1、前a

本文深入分析了即旉信(IM)pȝ中所面的各U安全问题,l合利用对称加密法QDES法Q、公开密钥法QRSA法Q和Hash法(MD5)的优点,探讨l合加密法在即旉信中的应用?/p>

技术交:

- Ud端IM开发入门文章:?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">新手入门一就够:从零开发移动端IM?/p>

- 开源IM框架源码Q?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">https://github.com/JackJiang2011/MobileIMSDKQ?a rel="noopener nofollow" target="_blank" style="color: #1d58d1; text-decoration-line: none;">备用地址ҎQ?/p>

Q?/a>本文已同步发布于Qhttp://www.52im.net/thread-217-1-1.htmlQ?/a>

2、IM安全pd文章

本文是IM通讯安全知识pd文章中的W?,ȝ录如下:

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(一Q:正确地理解和使用Android端加密算?/a>?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(二)Q探讨组合加密算法在IM中的应用》(本文Q?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(三)Q常用加解密法与通讯安全讲解?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(四)Q实例分析Android中密钥硬~码的风?/a>?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(五)Q对U加密技术在Android上的应用实践?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(六)Q非对称加密技术的原理与应用实?/a>?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(七)Q用JWT技术解决IMpȝSocket长连接的w䆾认证痛点?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(八)Q如果这h理解HTTPS原理Q一就够了?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(九)Q你知道QHTTPS用的是对U加密还是非对称加密Q?/a>?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(十)Qؓ什么要用HTTPSQ深入浅出,探密短连接的安全?/a>?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(十一Q:IM聊天pȝ安全手段之通信q接层加密技?/a>?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(十二Q:IM聊天pȝ安全手段之传输内容端到端加密技?/a>?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(十三Q:信创必学Q一文读懂什么是国密法?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(十四Q:|络端口的安全防护技术实?/a>?/p>

?a target="_blank" rel="noopener nofollow" style="color: #1d58d1; text-decoration-line: none;">x通讯安全(十五Q:详解编码密码的泄漏风险及其扫描原理和工?/a>?/p>

3、即旉信应用所面的安全问?/h1>

x通信pȝ大都采用C/S、B/S、P2P{技术来实现x通信的功能,软g~制没有l一的标准,使得IMpȝ本n存有多种安全漏洞Q加上用L乏安全意识,D在用即旉信pȝ时出现各U安全问题?/p>

3.1 信息H取问题

目前的IMpȝ在交换信息或传输文g时仅仅采用了弱加密甚至不加密的方式,d者利用此~陷监听、窃取重要数据,q种泄密可能性给企业或个人造成不可估量的损失,其是对一些特D行业,如金融和证券{行业,会构成巨大的商业安全威胁,q种d的类型是对信息机密性的d?/p>

3.2 信息改问题

信息改又称中间人攻击,是攻击者试囑֜IMpȝ信息交互q程中,通过监听、窃取正常的信息,对信息进行修改后再发往信息接收斏V只要信息存在,可能出现这U攻击,它还可能d传输中的信息Q这U攻ȝcd是对信息完整性的d?/p>

3.3 信息伪造问?/h3>

在现有的IMpȝ中,接收方一般只Ҏ发送方的ID或发送过来的单信息进行确认,q样qd者提供了Z。攻击者通过令h误导的昵U或者迷惑性的语言Q骗取对方的信QQ从而套取信息、诈骗或辑ֈ其他不良目的。这U攻ȝcd是对信息真实性的d?/p>

3.4 其他问题

׃IMpȝ的文件传输采取了P2P模式Q它可以文件作为附仉过点对Ҏ式传送,而绕q网l周边安全防御设备。由于点对点隧道直接传至桌面计算机,因此受感染的文g借即旉信pȝpl过防病毒网关的扫描Q各U病毒如蠕虫、特z伊木马{可以借此L地进入网l,很多被病毒感染的文g则可能利用即旉信pȝq行传播?/p>

d者也可以用缓冲区溢出、拒l服务等d方式Q通过IMpȝ的安全漏z对整个|络pȝq行d或传播病毒?/p>

4、主的加密法介绍

4.1 对称加密QDES法

DESx据加密标准,q种加密法是由IBM研究提出来的Q?是一U分l密码,它用于对64比特的数据进行加密和解密。DES法所用的密钥也是64比特Q但׃其中包含?个比特的奇偶校验位,因而实际的密钥长度?6比特。DES法多次l合替代法和换位算法,利用分散和错q怺作用Q把明文~制成密码强度很高的密文。DES法的加密和解密的流E是完全相同的,区别仅仅是加密与解密使用子密钥序列的序正好相反n1。DES法属于对称加密法Q即加密和解密共享同一个密钥,主要用于解决数据机密性问题?/p>

4.2 公开密钥法QRSA法

RSA法作ؓ惟一被广泛接受ƈ实现的通用公共密钥加密ҎQ是众多阐述非对U密码体制的法中最具代表性的Q几乎成了公开密钥密码学的同义词。它是麻省理工大学的RivestQShamir和AdlemanQRSA法即ؓ三h名字的羃写)?977q研制ƈ?978q首ơ发表的一U算法。该法的数学基是数论的Ƨ拉定理Q它的安全性依赖于大数的因子分解的困难性,该算法至今仍没有发现严重的安全漏z。RSA使用两个密钥Q一个是公钥(PubHc Key)Q另一个是U钥(Private Key)加密时把明文分戍块,块的大小可变Q但不超q密钥的长度。RSA把明文块转化Z密钥长度相同的密文。其法如下Q?/p>

首先选择两个相异大质数p、qQ计n=pqQ取于n的数e与(p-lQ?q-l)互质。根据给定的eQ再选择d满ed除以z的模余数?Q即满ed mod (p-l)(q-l)=1Q,ҎƧ几里得法(a=bn+cQ则a与b的最大公因子q于b与c的最大公因子)Q这Ld-定可以找到。这h?nQe)为公钥,数对(nQd)为私钥在~码Ӟ假设资料为AQ将其分戍等长数据N块,每块为nKn。计C=llle mod nQ则c是~码后的资料。至于解码,取III=Cd mod n。黑客攻L怨得到eQ这样就必须对nq行因式分解Q选择_大的质数p、q便能L分解因式?/p>

对于p、q的选择Q一般来说是_大的素数Q对于大敎ͼq没有一个确定的界限Q因为随着计算机技术的发展Q破解能力正在逐步增强Q根据摩定理计能?8个月q一番)。RSA实验室的是,安全性要求相对较低时Qp和q的乘U达?68位;安全性要求相对较高时Q乘U达?024位以上?/p>

RSA法q可以用?#8220;数字{֐”Q即用私钥进行加密,公钥来解密?/p>

4.3 Hash法QMD5法

MD5法q不是加密算法,但却能Ş成信息的数字“指纹”Q主要用途是保数据没有被篡Ҏ变化q,以保证数据的完整性。MD5法有三个特性:

  • 1Q?/strong>能处理Q意大的信息Qƈ生成固定长度128位的信息摘要Q?/li>
  • 2Q?/strong>h不可预见性,信息摘要的大与原始信息的大没有Q何联p,原信息的每一个微变化都会对信息摘要产生很大的媄响;
  • 3Q?/strong>h不可逆性,没有办法通过信息摘要直接恢复原信息?/li>

5、应用探讨:l合加密法实现x通信pȝ的认证模?/h1>

本文l合利用以上法的优点,在IMpȝ中徏立以下消息发送模型,以解决IMpȝ所面的信息窃取、篡攏V伪造等安全问题。模型中用户A和B为IMpȝ的客LQ用户A和B之间彼此拥有Ҏ的公钥或数字证书QA向B发送消息,其全q程如图1所C?/p>

对于IMpȝ中蠕虫病毒感染安全问题的处理Q通过以下模型q行处理Q如?所C?/p>

6、应用探讨:l合加密法实现x通信pȝ的通信模型

按照以上加密认证模型Q徏立如?所C的安全x通信pȝ的实现模型,该模型包含两个层ơ的认证Q一是服务器与客h之间的双向认证,二是客户Z客户Z间的双向认证Q即在两端连接发送数据之前,必须协商q交换密钥信息。服务器作ؓ自签|证书的CA认证中心Q认证的所采用的密码技术极为公开密密钥技术?/p>

模型中的公开密钥技术充当了加密׃n密钥和数字签名的作用Q以解决服务器与客户机、客h与客h之间的n份鉴别和客户Z间进行数据通信的密钥传输问题。在Java密码术体pȝ构中Q密钥生成和操作可以使用keytoolE序来执行?/p>

7、应用探讨:l合加密法应用模型的安全性及效率分析

在以上模型中Q利用对U加密算法处理消息、文件的加密Q以解决信息、文件传送的机密性问题,h加密速度快的特点Q用公开密钥法的加密技术解决了对称密钥在网l中明文传输问题Q用Hash法计算出摘要,再通过公开密钥法的数字签名技术对摘要q行{֐Q既提高了效率,又保证了信息文g传输的鉴别和不可否认性;在文件处理过E中Q通过病毒扫面和组合加密双重处理,减少了网l中文g传输病毒蠕虫感染的几率?/p>

更多有关IM安全和架构资?/h1>

[1] 传输层安全协议SSL/TLS的Javaq_实现介和Demo演示?/p>

[2] 理论联系实际Q一套典型的IM通信协议设计详解Q含安全层设计)?/p>

[3] 微信C代通信安全解决ҎQ基于TLS1.3的MMTLS详解?/p>

[4] 来自阉KOpenIMQ打造安全可靠即旉讯服务的技术实践分?/a>?/p>

[5] q实旉视频聊天中端到端加密QE2EEQ的工作原理?/p>

[6] Ud端安全通信的利?#8212;—端到端加密(E2EEQ技术详?/a>?/p>

[7] Web端即旉讯安全Q跨站点WebSocket劫持漏洞详解(含示例代??/p>

[8] 通俗易懂Q一掌握即旉讯的消息传输安全原?/a>?/p>

[9] IM开发基知识补课(?Q正理解HTTP短连接中的Cookie、Session和Token?/p>

[10] 快速读懂量子通信、量子加密技?/a>?/p>

[11] x通讯安全(七)Q如果这h理解HTTPS原理Q一就够了?/p>

[12] 一分钟理解 HTTPS 到底解决了什么问?/a>?/p>

[13] 一读懂HTTPSQ加密原理、安全逻辑、数字证书等?/p>

[14] ZNetty的IM聊天加密技术学习:一文理清常见的加密概念、术语等

[15] 手把手教你ؓZNetty的IM生成自签名SSL/TLS证书

[16] 微信技术分享:揭秘微信后台安全特征数据仓库的架构设?/a>

[17] 零基IM开发入??Q什么是IMpȝ的实时性?

[18] 零基IM开发入??Q什么是IMpȝ的可靠性?

[19] 零基IM开发入??Q什么是IMpȝ的消息时序一致性?

[20] 新手入门一就够:从零开发移动端IM

[21] 转{q_IMpȝ架构设计与实?一)Q整体架构设?/a>

[22] Z实践Q一套百万消息量规模IMpȝ技术要Ҏȝ

[23] 一套亿U用LIM架构技术干?上篇)Q整体架构、服务拆分等

[24] 一套亿U用LIM架构技术干?下篇)Q可靠性、有序性、弱|优化等

[25] 一套v量在U用LUd端IM架构设计实践分n(含详l图?

[26] 一套原创分布式x通讯(IM)pȝ理论架构Ҏ

Q本文已同步发布于:http://www.52im.net/thread-217-1-1.htmlQ?/a>



Jack Jiang 2025-02-26 11:32 发表评论
]]> վ֩ģ壺 Ȫ| | | | | ˮ| ƽ| ԭ| | | ɽ| С| | | | | | °| ˮ| | | | | | | ˮ| | | | Զ| | | | | | | | ƽ| | | |