Skip to content

Commit

Permalink
1. fix type error at runtime
Browse files Browse the repository at this point in the history
2. add contributors info
3. add socket_io_common dependency
4. change version to 0.9.0 for Dart 2
  • Loading branch information
jumperchen committed Nov 20, 2018
1 parent 8c7e7a6 commit 6980fbb
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 27 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ If you are new to Git or GitHub, please read [this guide](https://help.github.co
## Socket.io Dart Server

* [socket.io-dart](https://github.com/rikulo/socket.io-dart)


## Contributors
* Thanks [@felangel](https://github.com/felangel) for https://github.com/rikulo/socket.io-client-dart/issues/7
4 changes: 2 additions & 2 deletions lib/socket_io_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
library socket_io_client;

import 'package:logging/logging.dart';
import 'package:socket_io/src/engine/parser/parser.dart' as Parser;
import 'package:socket_io_common/src/engine/parser/parser.dart' as Parser;
import 'package:socket_io_client/src/engine/parseqs.dart';
import 'package:socket_io_client/src/manager.dart';

Expand Down Expand Up @@ -42,7 +42,7 @@ final Logger _logger = new Logger('socket_io_client');
io(uri, [opts]) => _lookup(uri, opts);

_lookup(uri, opts) {
opts = opts ?? {};
opts = opts ?? <dynamic, dynamic>{};

Uri parsed = Uri.parse(uri);
var id = '${parsed.scheme}://${parsed.host}:${parsed.port}';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/engine/parseqs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ encode(Map obj) {
* @api private
*/
decode(qs) {
var qry = {};
var qry = <dynamic, dynamic>{};
var pairs = qs.split('&');
for (var i = 0, l = pairs.length; i < l; i++) {
var pair = pairs[i].split('=');
Expand Down
6 changes: 3 additions & 3 deletions lib/src/engine/socket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import 'dart:convert';
import 'dart:html';

import 'package:logging/logging.dart';
import 'package:socket_io/src/util/event_emitter.dart';
import 'package:socket_io_common/src/util/event_emitter.dart';
import 'package:socket_io_client/src/engine/parseqs.dart';
import 'package:socket_io/src/engine/parser/parser.dart' as parser;
import 'package:socket_io_common/src/engine/parser/parser.dart' as parser;
import 'package:socket_io_client/src/engine/transport/polling_transport.dart';
import 'package:socket_io_client/src/engine/transport/transports.dart';

Expand Down Expand Up @@ -68,7 +68,7 @@ class Socket extends EventEmitter {
bool upgrading;

Socket(String uri, Map opts) {
opts = opts ?? {};
opts = opts ?? <dynamic, dynamic>{};

if (uri.isNotEmpty) {
this.uri = Uri.parse(uri);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/engine/transport/polling_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:socket_io_client/src/engine/parseqs.dart';
*/
import 'package:socket_io_client/src/engine/transport/transports.dart';
import 'package:logging/logging.dart';
import 'package:socket_io/src/engine/parser/parser.dart';
import 'package:socket_io_common/src/engine/parser/parser.dart';

final Logger _logger = new Logger('socket_io:transport.PollingTransport');

Expand Down Expand Up @@ -178,7 +178,7 @@ abstract class PollingTransport extends Transport {
* @param {Function} drain callback
* @api private
*/
write(List<Map> packets) {
write(List packets) {
var self = this;
this.writable = false;
var callbackfn = (_) {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/engine/transport/transports.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* Copyright (C) 2017 Potix Corporation. All Rights Reserved.
*/
import 'package:logging/logging.dart';
import 'package:socket_io/src/engine/parser/parser.dart';
import 'package:socket_io/src/util/event_emitter.dart';
import 'package:socket_io_common/src/engine/parser/parser.dart';
import 'package:socket_io_common/src/util/event_emitter.dart';
import 'package:socket_io_client/src/engine/socket.dart';
import 'package:socket_io_client/src/engine/transport/jsonp_transport.dart';
import 'package:socket_io_client/src/engine/transport/websocket_transport.dart';
Expand Down Expand Up @@ -133,7 +133,7 @@ abstract class Transport extends EventEmitter {
* @param {Array} packets
* @api private
*/
send(List<Map> packets) {
send(List packets) {
if ('open' == this.readyState) {
this.write(packets);
} else {
Expand Down Expand Up @@ -167,7 +167,7 @@ abstract class Transport extends EventEmitter {
/**
* Called with a decoded packet.
*/
onPacket(Map packet) {
onPacket(packet) {
this.emit('packet', packet);
}

Expand All @@ -181,7 +181,7 @@ abstract class Transport extends EventEmitter {
this.emit('close');
}

void write(List<Map> data);
void write(List data);
void doOpen();
void doClose();
}
2 changes: 1 addition & 1 deletion lib/src/engine/transport/websocket_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import 'dart:async';
import 'dart:html';
import 'package:logging/logging.dart';
import 'package:socket_io/src/engine/parser/parser.dart';
import 'package:socket_io_common/src/engine/parser/parser.dart';
import 'package:socket_io_client/src/engine/parseqs.dart';
import 'package:socket_io_client/src/engine/transport/transports.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/engine/transport/xhr_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:html';

import 'dart:typed_data';
import 'package:logging/logging.dart';
import 'package:socket_io/src/util/event_emitter.dart';
import 'package:socket_io_common/src/util/event_emitter.dart';
import 'package:socket_io_client/src/engine/transport/polling_transport.dart';

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/src/manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import 'dart:async';
import 'dart:math' as Math;

import 'package:logging/logging.dart';
import 'package:socket_io/src/util/event_emitter.dart';
import 'package:socket_io/src/parser/parser.dart';
import 'package:socket_io_common/src/util/event_emitter.dart';
import 'package:socket_io_common/src/parser/parser.dart';
import 'package:socket_io_client/src/on.dart';
import 'package:socket_io_client/src/socket.dart';
import 'package:socket_io_client/src/engine/socket.dart' as Engine;
Expand Down Expand Up @@ -58,7 +58,7 @@ class Manager extends EventEmitter {
bool skipReconnect;

Manager({uri, Map options}) {
options = options ?? {};
options = options ?? <dynamic, dynamic>{};

options['path'] ??= '/socket.io';
this.nsps = {};
Expand Down
2 changes: 1 addition & 1 deletion lib/src/on.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:socket_io/src/util/event_emitter.dart';
import 'package:socket_io_common/src/util/event_emitter.dart';

/**
* on.dart
Expand Down
8 changes: 4 additions & 4 deletions lib/src/socket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
* Copyright (C) 2017 Potix Corporation. All Rights Reserved.
*/
import 'package:logging/logging.dart';
import 'package:socket_io/src/util/event_emitter.dart';
import 'package:socket_io_common/src/util/event_emitter.dart';
import 'package:socket_io_client/src/manager.dart';
import 'package:socket_io_client/src/on.dart' as ON;
import 'package:socket_io/src/parser/parser.dart';
import 'package:socket_io_common/src/parser/parser.dart';

/**
* Internal events (blacklisted).
Expand Down Expand Up @@ -208,7 +208,7 @@ class Socket extends EventEmitter {
* @param {String} reason
* @api private
*/
onclose(String reason) {
onclose(reason) {
_logger.fine('close ($reason)');
this.emit('disconnecting', reason);
this.connected = false;
Expand All @@ -223,7 +223,7 @@ class Socket extends EventEmitter {
* @param {Object} packet
* @api private
*/
onpacket(Map packet) {
onpacket(packet) {
if (packet['nsp'] != this.nsp) return;

switch (packet['type']) {
Expand Down
8 changes: 6 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: socket_io_client
description: Dartlang port of socket.io-client
version: 0.8.2
version: 0.9.0
author: jumperchen <[email protected]>
homepage: https://www.zkoss.org

Expand All @@ -9,8 +9,12 @@ environment:

dependencies:
logging: ^0.11.3+2
socket_io: any
socket_io_common: any

dev_dependencies:
test: ">=1.3.0 <2.0.0"
build_runner: ^1.0.0
build_web_compilers: ^0.4.4
socket_io: any


3 changes: 1 addition & 2 deletions test/index.html → web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Socket.io Demo</title>
<script defer type="application/dart" src="main.dart"></script>
<script defer src="packages/browser/dart.js"></script>
<script defer src="main.dart.js"></script>
</head>
<body>

Expand Down
File renamed without changes.

0 comments on commit 6980fbb

Please sign in to comment.