Search packages, repositories and app categories

Package detailsv1.0.1

socket_io

Port of JS/Node library Socket.io. It enables real-time, bidirectional and event-based communication cross-platform.

AndroidiOSmacOSWindowsLinux
30-day downloads
1.6K
Likes
134
Pub points
130

Install package

flutter pub add socket_io

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Socket.IO is a Dart port of the popular JavaScript/Node.js Socket.IO library, enabling real-time, bidirectional, and event-driven communication across platforms. It supports WebSocket and fallback transports, making it ideal for applications requiring live updates, such as chat apps, collaborative tools, or live dashboards. The package integrates seamlessly with Flutter, offering consistent behavior on Android, iOS, macOS, Windows, and Linux. It provides event emission, room management, and connection handling with ease.

Use cases

  • Real-time chat applications
  • Live data synchronization
  • Collaborative editing tools
  • IoT device monitoring
  • Multiplayer game networking

Key features

  • Cross-platform WebSocket support
  • Event-based communication
  • Automatic transport fallback
  • Room and namespace management
  • Simple API for emit and listen

Suitable for

  • Real-time web and mobile apps
  • Applications needing live updates
  • Developers familiar with Socket.IO
  • Projects requiring low-latency communication

Considerations

  • Requires a compatible server (e.g., Node.js Socket.IO)
  • May need additional configuration for firewalls
  • Performance depends on network conditions
  • Not suitable for high-frequency, low-latency scenarios without optimization

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

socket.io-dart

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

Usage

import 'package:socket_io/socket_io.dart';

main() {
    var io = new Server();
    var nsp = io.of('/some');
    nsp.on('connection', (client) {
      print('connection /some');
      client.on('msg', (data) {
        print('data from /some => $data');
        client.emit('fromServer', "ok 2");
      });
    });
      io.on('connection', (client) {
        print('connection default namespace');
        client.on('msg', (data) {
          print('data from default => $data');
          client.emit('fromServer', "ok");
        });
      });
      io.listen(3000);
}
// JS client
var socket = io('http://localhost:3000');
socket.on('connect', function(){console.log('connect')});
socket.on('event', function(data){console.log(data)});
socket.on('disconnect', function(){console.log('disconnect')});
socket.on('fromServer', function(e){console.log(e)});
// Dart client
import 'package:socket_io_client/socket_io_client.dart' as IO;

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(_));

Multiplexing support

Same as Socket.IO, this project allows you to create several Namespaces, which will act as separate communication channels but will share the same underlying connection.

Room support

Within each Namespace, you can define arbitrary channels, called Rooms, that sockets can join and leave. You can then broadcast to any given room, reaching every socket that has joined it.

Transports support

Refers to engine.io

  • polling: XHR / JSONP polling transport.
  • websocket: WebSocket transport.

Adapters support

Notes to Contributors

Fork socket.io-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 Client

Contributors

  • Thanks @felangel for https://github.com/rikulo/socket.io-dart/issues/7
  • Thanks @ThinkDigitalSoftware for https://github.com/rikulo/socket.io-dart/pull/15
  • Thanks @guilhermecaldas for https://github.com/rikulo/socket.io-dart/pull/16
  • Thanks @jodinathan for https://github.com/rikulo/socket.io-dart/pull/17
  • Thanks @jodinathan for https://github.com/rikulo/socket.io-dart/pull/18
  • Thanks @nicobritos for https://github.com/rikulo/socket.io-dart/pull/46
  • Thanks @nicobritos for https://github.com/rikulo/socket.io-dart/pull/47

Categories

Dependencies

Dependency list 4 items

Source repository

Projects using this package

No data available yet.