-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Fix #12 Sending buffer data is not working!
2. Bump 3.0.0
- Loading branch information
1 parent
89f29a0
commit 30a9784
Showing
9 changed files
with
147 additions
and
26 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,4 @@ decodePacket(dynamic encodedPacket, binaryType) { | |
} else { | ||
return {'type': PACKET_TYPES_REVERSE[type]}; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import 'dart:typed_data'; | ||
|
||
import 'package:socket_io_common/src/parser/is_binary.dart'; | ||
|
||
createMap(TypedData? byteData) => { | ||
"child": byteData, | ||
}; | ||
|
||
createMapWithArray(TypedData? byteData) => { | ||
"child": [byteData] | ||
}; | ||
|
||
createDeepMap(TypedData? byteData) => { | ||
"child": { | ||
"deep": {"deep": byteData} | ||
}, | ||
}; | ||
|
||
createDeepMapWithArray(TypedData? byteData) => { | ||
"child": { | ||
"deep": { | ||
"deep": [byteData] | ||
} | ||
}, | ||
}; | ||
|
||
createArray(TypedData? byteData) => [byteData]; | ||
|
||
createArrayInArray(TypedData? byteData) => [ | ||
[byteData] | ||
]; | ||
|
||
createArrayWithMap(TypedData? byteData) => [createMap(byteData)]; | ||
|
||
createArrayWithDeepMap(TypedData? byteData) => [createDeepMap(byteData)]; | ||
|
||
createMapWithToJson(TypedData? byteData) => { | ||
"toJSON": () => {"child": byteData} | ||
}; | ||
|
||
main() { | ||
final byteData = ByteData(1); | ||
|
||
// ------------- | ||
print("With ByteBuffer: ${hasBinary(byteData.buffer)}"); | ||
print("With ByteData: ${hasBinary(byteData)}"); | ||
print("-" * 30); | ||
// ------------- | ||
print("With map and binary: ${hasBinary(createMap(byteData))}"); | ||
print("With map and null: ${hasBinary(createMap(null))}"); | ||
print("-" * 30); | ||
// ------------- | ||
print( | ||
"With map with array and binary: ${hasBinary(createMapWithArray(byteData))}"); | ||
print("With map with array and null: ${hasBinary(createMapWithArray(null))}"); | ||
print("-" * 30); | ||
// ------------- | ||
print("With deep map and binary: ${hasBinary(createDeepMap(byteData))}"); | ||
print("With deep map and null: ${hasBinary(createDeepMap(null))}"); | ||
print("-" * 30); | ||
// ------------- | ||
print( | ||
"With deep map with array and binary: ${hasBinary(createDeepMapWithArray(byteData))}"); | ||
print( | ||
"With deep map with array and null: ${hasBinary(createDeepMapWithArray(null))}"); | ||
print("-" * 30); | ||
// ------------- | ||
print("With array and binary: ${hasBinary(createArray(byteData))}"); | ||
print("With array and null: ${hasBinary(createArray(null))}"); | ||
print("-" * 30); | ||
// ------------- | ||
print( | ||
"With array in array and binary: ${hasBinary(createArrayInArray(byteData))}"); | ||
print("With array in array and null: ${hasBinary(createArrayInArray(null))}"); | ||
print("-" * 30); | ||
// ------------- | ||
print( | ||
"With array with map and binary: ${hasBinary(createArrayWithMap(byteData))}"); | ||
print("With array with map and null: ${hasBinary(createArrayWithMap(null))}"); | ||
print("-" * 30); | ||
// ------------- | ||
print( | ||
"With array with deep map and binary: ${hasBinary(createArrayWithDeepMap(byteData))}"); | ||
print( | ||
"With array with deep map and null: ${hasBinary(createArrayWithDeepMap(null))}"); | ||
print("-" * 30); | ||
// ------------- | ||
print("With toJSON and binary: ${hasBinary(createMapWithToJson(byteData))}"); | ||
print("With toJSON and null: ${hasBinary(createMapWithToJson(null))}"); | ||
print("With toJSON from an Object: ${hasBinary(MyObject())}"); | ||
} | ||
|
||
class MyObject { | ||
Map toJSON() { | ||
return {"child": ByteData(1)}; | ||
} | ||
} |