【Unity】使用BestHTTP进行https通信

最近只写了一篇关于Unity的文章。
这一次是 https 通信。

 

BestHTTP 允许使用 TLS1.2 进行 https 通信!


  

  在 Unity 中与服务器通信时,WWW 类使通信变得非常简单。

但是,虽然 WWW 类可以轻松实现通信功能,但它隐藏了很多细节,因此,如果你想做更多的更进一步的操作,抛弃WWW类,

. 您将使用 Net 中内置的类实现它。在这种情况下,如果要与 https 通信,请使用 System.Net.Security.SslStream 类等。

但还有更多的陷阱在那里!!


在 Unity 中使用 SslStream 类实现时,无法与 TLS1.1 或 TLS1.2 通信。如果您需要尽可能强大的安全性,这有点麻烦。

原因是 Unity 符合 .Net 3.5 标准。
在 .Net 4.5 中,您可以选择 TLS1.2。
在 .Net 3.5 中,无法选择 TLS1.1 或 TLS1.2,并且只能选择 TLS1.0。
在 TLS1.0 中,安全仍有一些焦虑。

 

但是,如果引入名为 BestHTTP 的 Asset,则 TLS1.2 能够与 https 通信。

BestHTTP(专业版)在 AssetStore 上售价为 60 美元(2019 年 12 月 5 日) 价格有点高,但考虑到内容,价格是令人信服的。

 

Best HTTP/2支持WebSocket!

 

WebSocket features:
- Full RFC compliance
- Easy to use, 'just works' experience
- Support for extensions:
Compression Extensions for WebSocket (RFC7692)

Socket.IO features:
- Compliance with the latest (1.x and 2.x) Socket.IO implementations
- Automatic transport upgrade and downgrade
- Binary data sending and receiving
- You can plug in your favorite Json decoder

SignalR Core features:
- Supports latest SignalR Core
- Support for MessagePack encoding
- Strongly typed callbacks
- Uses the fastest Websocket transport with fallback option to long-polling
- Package includes a Header-based authenticator
- Upload and download streaming

SignalR features:
- Works with the latest SignalR implementation
- Easy to use API
- Hubs
- Support for authentication
- Progress messages for long running jobs
- Automatic transport upgrade/downgrade
- You can plug in your favorite Json decoder

Server-Sent Events features:
- Compatible with the latest specification
- Easy to use API

 

posted on 2019-12-27 14:36  jiahuafu  阅读(9108)  评论(1编辑  收藏  举报

导航