Best HTTP¶
Welcome to the Best HTTP Documentation! Best HTTP is a comprehensive networking library for Unity that empowers developers to make HTTP and HTTPS requests with ease. Whether you're building web applications, multiplayer games, or real-time communication solutions, Best HTTP has got you covered.
Overview¶
In today's digital era, efficient and reliable web communication forms the backbone of many applications. Whether you're fetching data from remote servers, sending game scores, or updating user profiles, HTTP requests are indispensable. Recognizing the multifaceted needs of Unity developers, Best HTTP is designed to simplify these interactions, providing a streamlined and efficient means to handle web-based communication.
Core Dependency for Extended Functionality ¶
Best HTTP stands as the backbone for a multitude of specialized networking assets. Its robust and efficient architecture serves as a fundamental dependency, powering numerous other packages like Best WebSockets, Best MQTT, Best Socket.IO, Best SignalR and more. This central role ensures that when you invest in Best HTTP, you're not just getting a standalone package, but a gateway to a suite of advanced networking tools, all unified in their reliability and performance.
Key Features¶
- Supported Unity Versions: Best HTTP is compatible with Unity versions starting from 2021.1 onwards.
Cross-Platform: Best HTTP is designed to work seamlessly across a diverse range of Unity platforms, ensuring versatility for all your development needs. Specifically, it supports:
- Desktop: Windows, Linux, MacOS
- Mobile: iOS, Android
- Universal Windows Platform (UWP)
- Web Browsers: WebGL
Furthermore, user reports suggest that Best HTTP also functions on the following platforms. However, due to the lack of testing capabilities, official support for these platforms is not provided:
- Xbox
- PlayStation
- Nintendo Switch
Please note that while there is evidence of compatibility with these platforms, I'm unable to offer official support or guarantee full functionality due to testing limitations.
This broad platform support means you can confidently use Best HTTP, regardless of your target audience or deployment strategy.
Versatile Request Outcome Handling: Best HTTP ensures flexibility in managing network request outcomes to seamlessly fit within your development style and the varied structures of different applications:
- Traditional Callbacks: Adopt the classic approach with regular C# callbacks. Ideal for those who prefer traditional programming patterns, allowing for simple and straightforward handling of responses.
- Unity Coroutines: For those who are deeply integrated with Unity's workflow, Best HTTP provides native support for Unity's coroutines. This facilitates non-blocking operations while keeping the code structure clean and readable, particularly when sequencing multiple network requests.
- Async-Await Pattern: Embrace the modern C# asynchronous programming paradigm with the async-await pattern. Best HTTP's support for this ensures that developers can write non-blocking code in a linear fashion, greatly simplifying error handling and state management for asynchronous operations.
With these diverse options for request outcome handling, developers can choose the best approach that aligns with their project requirements and personal coding preferences.
Universal Compatibility with No Special Server Setup: Best HTTP is designed to seamlessly integrate into any environment. Whether you're working with legacy systems or the latest server technologies, Best HTTP ensures smooth communication and operation. You don't need to worry about specific server configurations or additional setup procedures; it's built to be universally compatible. With Best HTTP, you gain the freedom to focus on your application's functionality, knowing that the underlying HTTP communications will work consistently across all server solutions.
- HTTP/HTTPS Support: Best HTTP supports both HTTP and HTTPS protocols, ensuring secure communication for your applications.
- HTTP/2 Support: Benefit from the advantages of HTTP/2, including faster loading times, reduced latency and trailing headers for advanced scenarios like GRPC.
- HTTP Caching: Implement efficient caching mechanisms to reduce redundant network requests, optimizing your application's performance and data usage.
- Authentication: Easily handle various authentication methods, such as Basic, Digest, and Bearer token authentication.
- Cookie Management: Manage cookies effortlessly, ensuring smooth user experiences in web applications.
- Compression: Compress and decompress data using gzip and deflate algorithms to save bandwidth and improve loading times.
- Streaming: Best HTTP supports streaming for both downloads and uploads. This enables you to stream large files and responses directly to storage when downloading, and stream data from storage when uploading, effectively avoiding memory bottlenecks.
- Customization: Tailor your HTTP requests with customizable headers, timeouts, and other parameters to meet your specific needs.
Built-In Profiler Support: Best HTTP now comes with a built-in profiler, ensuring developers have direct access to critical insights without the need for external tools. This enhancement is instrumental in understanding the performance and network behavior of your application, thereby facilitating optimization and debugging. Key features of the built-in profiler include:
- Memory Profiler: Dive into the library's internal memory usage. This tool is invaluable for ensuring optimal memory management and for identifying potential bottlenecks or leaks.
Network Profiler: This profiler allows for a granular analysis of your network operations. Notable features include:
- Byte Tracking: Monitor the bytes sent and received between two frames, providing a clear overview of data transfers and insight into traffic patterns.
- Connection Analysis: Stay informed on the total number of open and closed connections. This data gives a transparent view of your app's network activity.
- DNS Cache Profiling: With this feature, you can track DNS cache hits and misses, aiding in the fine-tuning of DNS cache strategies and understanding potential network resolution delays.
With the integration of this built-in profiler support, developers can not only ensure that their application's network activities are optimized but also make data-driven decisions that enhance both performance and user experience.
Debugging and Logging: Comprehensive logging options enable developers to get insights into the workings of the package and simplify the debugging process.
Best HTTP vs. UnityWebRequest: A Feature Matrix Comparison¶
When choosing a networking solution for your Unity projects, it's essential to have a clear understanding of how different tools compare. While Best HTTP offers a comprehensive feature set tailored for various networking needs, you might be wondering how it stands up against Unity's built-in UnityWebRequest. To aid in your decision-making process, I've prepared a feature matrix that compares the capabilities of both tools:
Feature | Best HTTP | UnityWebRequest |
---|---|---|
Basic HTTP Requests | Supports GET, POST, PUT, DELETE, HEAD, PATCH, MERGE, OPTIONS, QUERY | Supports GET, HEAD, POST, PUT, DELETE |
HTTPS Support | Supports different TLS backends on a per-host basis | Basic SSL/TLS support |
Custom Headers | Can add custom headers | Can add custom headers |
Timeout Handling | Supports both connect & request timeouts | Supports request timeouts |
Progress Reporting | Provides both download and upload progress updates | Provides progress updates |
Multi-threading & Concurrency | Can handle multiple requests concurrently | Can handle multiple requests concurrently |
HTTP/2 Support | Supported with options for customizations | (Depending on Unity version) |
Connection Pooling | Supported for both HTTP/1 and HTTP/2 connections | Unknown |
DNS Caching | Supported with prefetching capabilities | Not Supported |
Download Handling | Supports streaming with buffer control for memory-efficient downloads | Basic streaming support |
Upload Handling | Advanced control over upload streams | Supports basic upload handlers |
HTTP Caching | Advanced caching options | Only AssetBundles |
Custom Protocols | Supports protocol upgrades (like WebSocket) | Not supported |
Response Handling | Advanced response processing with support for auth. challanges, trailing headers, etc. | Basic response processing |
Blocking Mechanisms | Supports blocking streams for threaded processing | No built-in support |
Access downloaded data as a Stream | Built-in support | No built-in support |
Cookie Handling | Advanced cookie management | Basic cookie support |
Authentication | Supports multiple authentication methods | No direct support |
Proxy Handling | Advanced proxy settings and authentication | Basic proxy support |
Auto Redirect Handling | Supports automatic redirections with behavior change | Supports automatic redirections |
Platform Support | Desktop and mobile platforms + WebGL | Unity's platform support |
Exception Handling | Detailed exception handling and reporting | Basic error reporting |
Extensions & Plugins | Supports adding extensions and plugins | Limited or requires additional packages |
MovieTexture, AudioClip | No support | Supported |
Source Code | Included | Isn't available |
Supported programming models | Callbacks, coroutines, async-await | Coroutines |
Debugging Capabilities | Structured diagnostic logging | Not supported |
By juxtaposing Best HTTP with UnityWebRequest, it's evident that Best HTTP is designed to offer superior flexibility, extensive features, and refined controls to cater to the diverse needs of Unity developers. Whether you're looking for advanced request handling, native WebSocket support, or in-depth profiling capabilities, Best HTTP is equipped to elevate your networking tasks to the next level.
Is the feature matrix missing something? Let me know!
Documentation Sections¶
Explore the following sections to learn how to harness the power of Best HTTP in your Unity projects:
- Installation Guide: Get started with Best HTTP by installing the package and configuring your project.
- Upgrade Guide: If you're transitioning from Best HTTP/2, this guide provides vital information on changes, improvements, and steps to upgrade seamlessly to the latest version.
- Getting Started: Dive into the basics of making HTTP requests, handling responses, and configuring Best HTTP for your needs.
- Intermediate Topics: Take your skills to the next level with advanced topics, such as authentication, caching, upload/download streaming, and many more.
Whether you're a seasoned developer or just getting started with Unity, this documentation will guide you through the process of leveraging Best HTTP's capabilities to create efficient, feature-rich applications.
Let's get started with Best HTTP and elevate your Unity projects to new heights of networking excellence!