socket_io
JS/Node 라이브러리 Socket.io의 포트입니다. 실시간, 양방향 및 이벤트 기반 통신을 다중 플랫폼에서 가능하게 합니다.
socket.io-dart: socket.io의 Dartlang 버전 https://github.com/socketio/socket.io
^3.0.0^1.0.1^3.0.4^1.0.0^1.16.8^1.11.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Port of awesome JavaScript Node.js library - Socket.io v2.0.1 - in 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 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(_));
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.
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.
Refers to engine.io
polling: XHR / JSONP polling transport.websocket: WebSocket transport.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.