Skip to content
Alexandre Ardhuin edited this page Jun 15, 2016 · 2 revisions

The websocketd works by writing to stdin and reading from stdout.

Here's a simple echo.dart program that reads stdio lines and writes a basic response.

import 'dart:io';
import 'dart:convert';

main() {
  stdin
      .transform(SYSTEM_ENCODING.decoder)
      .transform(new LineSplitter())
      .listen((data) => print('You sent me : $data'));
}

You can use it with:

websocketd dart echo.dart
Clone this wiki locally