【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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM