protoo_client 0.3.0

  • Readme
  • Changelog
  • Installing
  • 74

pub package

protoo-client #

Dart version of the protoo-client js library.

Minimalist and extensible Dart signaling framework for multi-party Real-Time Communication applications

Usage #



import 'package:protoo_client/protoo_client.dart';

main() async {

  Peer peer = new Peer('ws://127.0.0.1:4442/?peer-id=yourId');

  peer.on('open', () {
    // After socket open to send a request.
    peer.send('login', {'username':'myname','password','mypass', 'other': {}})
    .then((data) {
      // Handle accept from server.
      print('response: ' + data.toString());
    }).catchError((error) {
      // Handle reject from server.
      print('response error: ' + error.toString());
    });
  });

  peer.on('close', () {
    print('close');
  });

  peer.on('error', (error) {
    print('error ' + error);
  });
 
  // Handle request from server.
  peer.on('request', (request, accept, reject) {
    print('request: ' + request.toString());
    reject(486, 'Busy Here!!!');
  });

  await peer.connect();
  peer.close();
}

Changelog #


[0.2.0] - 2019.12.18

  • Add support for Flutter Web.

[0.2.0] - 2019.12.18

  • Update

[0.1.0] - 2019.03.22

  • Initial release.

Use this package as a library

1. Depend on it

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


dependencies:
  protoo_client: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:protoo_client/protoo_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
68
Health:
Code health derived from static analysis. [more]
86
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
72
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on May 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev

Health issues and suggestions

Document public APIs. (-1 points)

14 out of 14 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/peer.dart. (-5.84 points)

Analysis of lib/src/peer.dart reported 12 hints, including:

line 12 col 7: The value of the field '_socket' isn't used.

line 15 col 7: The value of the field '_url' isn't used.

line 17 col 16: Unnecessary new keyword.

line 32 col 23: Unnecessary new keyword.

line 35 col 29: Unnecessary new keyword.

Fix lib/src/transports/websocket_transport.dart. (-2.96 points)

Analysis of lib/src/transports/websocket_transport.dart reported 6 hints, including:

line 2 col 8: Unused import: 'dart:io'.

line 3 col 8: Unused import: 'dart:math'.

line 10 col 14: Unnecessary new keyword.

line 24 col 25: Unnecessary new keyword.

line 25 col 25: Unnecessary new keyword.

Fix lib/src/message.dart. (-1.99 points)

Analysis of lib/src/message.dart reported 4 hints:

line 6 col 14: Unnecessary new keyword.

line 10 col 32: Unnecessary new keyword.

line 11 col 32: Unnecessary new keyword.

line 13 col 9: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Fix additional 5 files with analysis or formatting issues. (-2.99 points)

Additional issues in the following files:

  • lib/src/transports/websocket_dart_impl.dart (3 hints)
  • lib/src/logger.dart (1 hint)
  • lib/src/transports/websocket_web_impl.dart (1 hint)
  • lib/src/utils.dart (1 hint)
  • lib/protoo_client.dart (Run dartfmt to format lib/protoo_client.dart.)

Maintenance suggestions

The package description is too short. (-18 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and protoo_client.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >1.8.0 <3.0.0
events2 ^0.1.3 0.1.3