Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rikulo/socket.io-dart
socket.io-dart: Dartlang port of socket.io https://github.com/socketio/socket.io
https://github.com/rikulo/socket.io-dart
dart dartlang namespace quire server socket socket-io websocket
Last synced: 30 days ago
JSON representation
socket.io-dart: Dartlang port of socket.io https://github.com/socketio/socket.io
- Host: GitHub
- URL: https://github.com/rikulo/socket.io-dart
- Owner: rikulo
- License: mit
- Created: 2017-02-23T03:46:16.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-05T22:35:00.000Z (almost 2 years ago)
- Last Synced: 2024-09-29T01:01:54.503Z (about 1 month ago)
- Topics: dart, dartlang, namespace, quire, server, socket, socket-io, websocket
- Language: Dart
- Homepage: https://quire.io
- Size: 159 KB
- Stars: 121
- Watchers: 9
- Forks: 45
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# socket.io-dart
Port of awesome JavaScript Node.js library - [Socket.io v2.0.1](https://github.com/socketio/socket.io) - in Dart
## Usage
```dart
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
// 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
// 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](https://github.com/socketio/engine.io)- `polling`: XHR / JSONP polling transport.
- `websocket`: WebSocket transport.## Adapters support
* Default socket.io in-memory adapter class. Refers to [socket.io-adapter](https://github.com/socketio/socket.io-adapter)
## Notes to Contributors
### Fork socket.io-dart
If you'd like to contribute back to the core, you can [fork this repository](https://help.github.com/articles/fork-a-repo) and send us a pull request, when it is ready.
If you are new to Git or GitHub, please read [this guide](https://help.github.com/) first.
## Who Uses
* [Quire](https://quire.io) - a simple, collaborative, multi-level task management tool.
* [KEIKAI](https://keikai.io/) - a web spreadsheet for Big Data.## Socket.io Dart Client
* [socket.io-client-dart](https://github.com/rikulo/socket.io-client-dart)
## Contributors
* Thanks [@felangel](https://github.com/felangel) for https://github.com/rikulo/socket.io-dart/issues/7
* Thanks [@ThinkDigitalSoftware](https://github.com/ThinkDigitalSoftware) for https://github.com/rikulo/socket.io-dart/pull/15
* Thanks [@guilhermecaldas](https://github.com/guilhermecaldas) for https://github.com/rikulo/socket.io-dart/pull/16
* Thanks [@jodinathan](https://github.com/jodinathan) for https://github.com/rikulo/socket.io-dart/pull/17
* Thanks [@jodinathan](https://github.com/jodinathan) for https://github.com/rikulo/socket.io-dart/pull/18
* Thanks [@nicobritos](https://github.com/nicobritos) for https://github.com/rikulo/socket.io-dart/pull/46
* Thanks [@nicobritos](https://github.com/nicobritos) for https://github.com/rikulo/socket.io-dart/pull/47