websockets 0.2.1+1 copy "websockets: ^0.2.1+1" to clipboard
websockets: ^0.2.1+1 copied to clipboard

Dart 1 only

A platform-independent WebSocket library.

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.

0
likes
20
pub points
22%
popularity

Publisher

unverified uploader

A platform-independent WebSocket library.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

reflectable

More

Packages that depend on websockets