Skip to main content

dox_http_native 3.0.0-alpha.2 copy "dox_http_native: ^3.0.0-alpha.2" to clipboard
dox_http_native: ^3.0.0-alpha.2 copied to clipboard

Fast native HTTP/1.1 server for Dart and the Dox framework. Rust (hyper) parses HTTP, your handlers stay in Dart. Implements the dart:io HttpServer API.

dox_http_native #

A fast HTTP/1.1 server for Dart. Rust (hyper) owns the sockets and parses HTTP. Your handlers stay in Dart.

It implements the dart:io HttpServer, HttpRequest and HttpResponse API, so code written for dart:io works unchanged.

Dox uses it as its default server. You do not need to add it yourself when you use Dox.

import 'dart:io';

import 'package:dox_http_native/dox_http_native.dart';

void main() async {
  NativeHttpServer server = await NativeHttpServer.bind(3000);
  server.listen((HttpRequest req) {
    req.response.write('Hello World');
    req.response.close();
  });
}
  • No Rust needed: the build hook downloads a ready-built library (macOS arm64/x64, Linux x64/arm64, Windows x64).
  • Use dart run, dart test or dart build cli. dart compile exe does not run build hooks.
  • Each isolate can bind the same port (SO_REUSEPORT on Linux, one shared socket on macOS).
  • 400 for bad requests, 431 for headers over 16 KB, 413 for bodies over maxBodySize.
  • Not yet: WebSocket upgrade (detachSocket), streaming a response while it is written (the body is sent on close).

More: Native server.

0
likes
0
points
0
downloads

Publisher

verified publisherdartondox.dev

Weekly Downloads

Fast native HTTP/1.1 server for Dart and the Dox framework. Rust (hyper) parses HTTP, your handlers stay in Dart. Implements the dart:io HttpServer API.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

code_assets, crypto, hooks

More

Packages that depend on dox_http_native