The Protevus Platform: Unified Full-Stack Development https://protevus.com
Find a file
2019-09-29 01:28:34 -04:00
benchmark pedantic 2019-08-09 10:53:38 -04:00
cmake_dart_utils@315b1741fc switch to cmake because this is 2019 2019-09-29 00:13:22 -04:00
example Cmake install into root 2019-09-29 00:30:52 -04:00
lib Hangs indefinitely :))) 2019-09-29 01:28:34 -04:00
web Basic README 2018-07-10 11:06:29 -04:00
.clang-format Use fcntl to fix non-closing sockets 2019-09-29 01:26:27 -04:00
.gitignore Use fcntl to fix non-closing sockets 2019-09-29 01:26:27 -04:00
.gitmodules switch to cmake because this is 2019 2019-09-29 00:13:22 -04:00
analysis_options.yaml Finish build pipeline 2019-09-29 00:20:42 -04:00
CMakeLists.txt Use fcntl to fix non-closing sockets 2019-09-29 01:26:27 -04:00
libangel_wings.dylib Hangs indefinitely :))) 2019-09-29 01:28:34 -04:00
libangel_wings.so Use fcntl to fix non-closing sockets 2019-09-29 01:26:27 -04:00
provision.sh Use fcntl to fix non-closing sockets 2019-09-29 01:26:27 -04:00
pubspec.yaml Finish build pipeline 2019-09-29 00:20:42 -04:00
README.md Basic README 2018-07-10 11:06:29 -04:00
ubuntu-bionic-18.04-cloudimg-console.log Use fcntl to fix non-closing sockets 2019-09-29 01:26:27 -04:00
Vagrantfile Use fcntl to fix non-closing sockets 2019-09-29 01:26:27 -04:00

wings

Native HTTP driver for Angel, for a nice speed boost.

Not ready for production.

How does it work?

Typically, Angel uses the AngelHttp driver, which is wrapper over the HttpServer functionality in dart:io, which in turns uses the ServerSocket and Socket functionality. This is great - Dart's standard library comes with an HTTP server, which saves a lot of difficult in implementation.

However, abstraction tends to come with a cost. Wings seeks to minimize abstraction entirely. Rather than using the built-in Dart network stack, Wings' HTTP server is implemented in C++ as a Dart native extension, and the AngelWings driver listens to events from the extension and converts them directly into RequestContext objects, without any additional abstraction within. This reduces the amount of computation performed on each request, and helps to minimize response latency. Sending data from the response buffer in plain Dart surprisingly is the most expensive operation, as is revealed by the Observatory.

By combining Dart's powerful VM with a native code server based on the same one used in Node.js, AngelWings trims several milliseconds off every request, both saving resources and reducing load times for high-traffic applications.

How can I use it?

The intended way to use AngelWings is via package:build_native; however, the situation surrounding distributing native extensions is yet far from ideal, so this package includes pre-built binaries out-of-the-box.

Thanks to this, you can use it like any other Dart package, by installing it via Pub.

Brief example

Using AngelWings is almost identical to using AngelHttp; however, it does not support SSL, and therefore should be placed behind a reverse proxy like nginx in production.

main() async {
  var app = new Angel();
  var wings = new AngelWings(app, shared: true, useZone: false);

  app.injectEncoders({'gzip': gzip.encoder, 'deflate': zlib.encoder});

  app.get('/hello', 'Hello, native world! This is Angel WINGS.');

  var fs = const LocalFileSystem();
  var vDir = new VirtualDirectory(app, fs, source: fs.directory('web'));
  app.use(vDir.handleRequest);

  await wings.startServer('127.0.0.1', 3000);
  print('Listening at http://${wings.address.address}:${wings.port}');
}