websockets 0.2.1+1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 21

websockets

A platform-independent WebSocket library using the Dart async API.

This library defines a WebSocket interface very much like the one in dart:io that can be used when writing platform-independent packages like API-wrappers.

Documentation

The documentation for this library can be found on DartDocs.

Usage

Creating and using WebSockets with this library is easy, it works entirely the same as how the dart:io.WebSocket class works:

import "dart:io";
import "package:websockets/websockets.dart";

main() async {
  WebSocket ws = await WebSocket.connect("wss://echo.websocket.org");
  ws.listen(print);
  ws.add("test");
}

When developing platform-independent packages

Everything stays the same. The websockets import does not import dart:io or dart:html, so your code will run on both platforms. One thing to remember is that the user of your library has to make an explicit import of either of dart:io or dart:html.

Changelog

0.2.1

  • Environment import is no longer required in the browser.

0.2.0

  • Completely reworked the mirrors code to make WebSocket.connect work for dart:html
  • It is now also easier to add new environments that WebSocket.connect can work with
  • BrowserWebSocket class is removed
  • WebSocketConnector is removed

0.1.1

  • Added url getter

0.1.0

  • Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  websockets: ^0.2.1+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:websockets/websockets.dart';
  
Version Uploaded Documentation Archive
0.2.1+1 May 12, 2016 Go to the documentation of websockets 0.2.1+1 Download websockets 0.2.1+1 archive
0.2.1 Jan 19, 2016 Go to the documentation of websockets 0.2.1 Download websockets 0.2.1 archive
0.2.0+2 Jan 9, 2016 Go to the documentation of websockets 0.2.0+2 Download websockets 0.2.0+2 archive
0.2.0+1 Jan 9, 2016 Go to the documentation of websockets 0.2.0+1 Download websockets 0.2.0+1 archive
0.2.0 Jan 9, 2016 Go to the documentation of websockets 0.2.0 Download websockets 0.2.0 archive
0.1.1 Jun 17, 2015 Go to the documentation of websockets 0.1.1 Download websockets 0.1.1 archive
0.1.0 Jun 16, 2015 Go to the documentation of websockets 0.1.0 Download websockets 0.1.0 archive
0.0.0 Jun 16, 2015 Go to the documentation of websockets 0.0.0 Download websockets 0.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
21
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0