You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Isolate dart:io Usage to Enable Pluggable HTTP Backends #40
Currently, the project relies directly on dart:io for HTTP server functionality, which tightly couples the framework to a specific runtime implementation. This makes it difficult to support alternative HTTP drivers in the future.
Proposal
Abstract all direct usage of dart:io (e.g., HttpServer, HttpRequest, HttpResponse) behind a platform-agnostic interface. This interface should expose the functionality needed by the framework (e.g., route handling, header access, body parsing) without depending on the underlying transport.
Steps:
Identify all areas where dart:io is currently used.
Create interfaces or platform service classes (e.g., RelicRequest, RelicResponse, RelicServer).
Refactor the core framework to use these abstractions.
Move dart:io specific logic into an internal implementation that conforms to the new interface.
This will enable future experiments with alternative transports or runtime environments without requiring a rewrite of the core framework logic.
Use Case
In the future, we may want to:
Run Relic in WebAssembly where dart:io is unsupported.
Plug in a different HTTP backend optimized for a specific platform.
Write tests using mock implementations without needing real sockets.
Isolating dart:io usage now allows us to remain flexible and future-proof.
Alternatives
Only isolate parts of dart:io (e.g., just the request/response) rather than the whole server lifecycle.
Activity