-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23b4098
commit fc64882
Showing
6 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
// Author: jumperchen<[email protected]> | ||
|
||
import 'package:socket_io_client/socket_io_client.dart'; | ||
import 'package:socket_io_common/socket_io_common.dart'; | ||
import 'package:socket_io_common/src/util/event_emitter.dart'; | ||
|
||
/// Default event listeners for dart way API. | ||
|
@@ -60,6 +61,13 @@ extension DartySocket on Socket { | |
} | ||
} | ||
|
||
/// Parser options | ||
class ParserOptions { | ||
final Encoder Function() encoder; | ||
final Decoder Function() decoder; | ||
ParserOptions({required this.encoder, required this.decoder}); | ||
} | ||
|
||
/// Option Builder to help developer to construct an options map. | ||
class OptionBuilder { | ||
final Map<String, dynamic> _opts; | ||
|
@@ -114,6 +122,11 @@ class OptionBuilder { | |
return this; | ||
} | ||
|
||
/// The parser used to marshall/unmarshall packets for transport. | ||
OptionBuilder setParser(ParserOptions parserOptions) { | ||
_opts['parser'] = parserOptions; | ||
return this; | ||
} | ||
OptionBuilder setReconnectionAttempts(num attempts) { | ||
_opts['reconnectionAttempts'] = attempts; | ||
return this; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters