Skip to content
socket.io-client-dart: Dartlang port of socket.io-client https://github.com/socketio/socket.io-client
Branch: master
Clone or download
Latest commit fee34b5 Jan 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib add io_websocket transport for switching the implementation of dart.l… Jan 21, 2019
test
web
.gitignore
LICENSE
README.md 1. fix type error at runtime Nov 20, 2018
analysis_options.yaml
pubspec.yaml

README.md

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.
  • KEIKAI - a web spreadsheet for Big Data.

Socket.io Dart Server

Contributors

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.