socket_io_client 0.8.0

  • README.md
  • Installing
  • Versions
  • new45

socket.io-client-dart

Port of awesome JavaScript Node.js library - Socket.io-client v2.0.1 - in Dart

Usage

import 'package:socket_io/socket.io.dart';
import 'package:socket_io_client/socket_io_client.dart' as IO;

main() {
    // Dart server
    var io = new Server();
    var nsp = io.of('/some');
    nsp.on('connection', (Socket client) {
      print('connection /some');
      client.on('msg', (data) {
        print('data from /some => $data');
        client.emit('fromServer', "ok 2");
      });
    });
      io.on('connection', (Socket client) {
        print('connection default namespace');
        client.on('msg', (data) {
          print('data from default => $data');
          client.emit('fromServer', "ok");
        });
      });
      io.listen(3000);

    // Dart client
    IO.Socket socket = IO.io('http://localhost:3000');
    socket.on('connect', (_) {
     print('connect');
     socket.emit('msg', 'test');
    });
    socket.on('event', (data) => print(data));
    socket.on('disconnect', (_) => print('disconnect'));
    socket.on('fromServer', (_) => print(_));
}

Notes to Contributors

Fork socket.io-client-dart

If you'd like to contribute back to the core, you can fork this repository and send us a pull request, when it is ready.

If you are new to Git or GitHub, please read this guide first.

Who Uses

  • Quire - a simple, collaborative, multi-level task management tool.

Socket.io Dart Server

1. Depend on it

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


dependencies:
  socket_io_client: "^0.8.0"

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:socket_io_client/socket_io_client.dart';
        
Version Uploaded Documentation Archive
0.8.0 Apr 9, 2018 Go to the documentation of socket_io_client 0.8.0 Download socket_io_client 0.8.0 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
75 / 100
Overall score:
Weighted score of the above. [more]
45
Learn more about scoring.

Platforms

Detected platforms: web

Primary library: package:socket_io_client/socket_io_client.dart with components: html, js.

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Use constrained dependencies.

    The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: socket_io.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 30 hints.

    Run dartfmt to format lib/socket_io_client.dart.

    Run dartfmt to format lib/src/engine/parseqs.dart.

    Similar analysis of the following files failed:

    • lib/src/engine/socket.dart (hint)
    • lib/src/engine/transport/jsonp_transport.dart (hint)
    • lib/src/engine/transport/polling_transport.dart (hint)
    • lib/src/engine/transport/transports.dart (hint)
    • lib/src/engine/transport/websocket_transport.dart (hint)
    • lib/src/engine/transport/xhr_transport.dart (hint)
    • lib/src/manager.dart (hint)
    • lib/src/on.dart (hint)
    • lib/src/socket.dart (hint)
  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use socket_io_client.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0
logging >=0.11.3+1 <0.12.0 0.11.3+1
socket_io any 0.8.0
Transitive dependencies
args 1.4.2
async 2.0.6
charcode 1.1.1
collection 1.14.9
convert 2.0.1
crypto 2.0.2+1
http 0.11.3+16
http_parser 3.1.1
mime 0.9.6
path 1.5.1
rikulo_commons 2.3.8+1
source_span 1.4.0
stream 1.7.0
string_scanner 1.0.2
typed_data 1.1.5
uuid 0.5.3 1.0.0
Dev dependencies
browser any
test >=0.12.0 <0.13.0
unittest any