Revert "Add an option to SignalR to guarantee ordering of send events… (#10807)

This reverts commit 4646c4a5e4.
This commit is contained in:
Pranav K 2019-06-03 15:49:55 -07:00 committed by Nate McMaster
parent f44d4107fd
commit 39a9d63c10
20 changed files with 4293 additions and 9564 deletions

View File

@ -53,21 +53,6 @@
<Copy SourceFiles="$(PackageJson)" DestinationFiles="$(_BackupPackageJson)" />
<ReadLinesFromFile File="$(PackageJson)" Condition="@(ReplacePackageContent->Count()) != 0 AND $([MSBuild]::IsOSPlatform('Windows'))">
<Output TaskParameter="Lines" ItemName="PackageJsonContent" />
</ReadLinesFromFile>
<PropertyGroup Condition="@(PackageJsonContent->Count()) > 0">
<_PackageJsonContent>@(PackageJsonContent->'%(Identity)', '%0a')</_PackageJsonContent>
<_PackageJsonContent>$(_PackageJsonContent.Replace('%(ReplacePackageContent.Identity)', '%(ReplacePackageContent.ReplaceWith)'))</_PackageJsonContent>
</PropertyGroup>
<WriteLinesToFile
File="$(PackageJson)"
Lines="$(_PackageJsonContent)"
Condition="@(ReplacePackageContent->Count()) != 0 AND $([MSBuild]::IsOSPlatform('Windows'))"
Overwrite="true" />
<Yarn Command="version --no-git-tag-version --new-version $(PackageVersion)" />
<Yarn Command="pack --filename $(PackageFileName)" />

View File

@ -7,11 +7,23 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\SignalR\clients\ts\signalr-protocol-msgpack\signalr-protocol-msgpack.npmproj" />
<WebpackInputs Include="src\**\*.ts" />
<WebPackOutputs Include="dist\Debug\blazor.webassembly.js" />
<WebPackOutputs Include="dist\Release\blazor.webassembly.js" />
<WebPackOutputs Include="dist\Debug\blazor.server.js" />
<WebPackOutputs Include="dist\Release\blazor.server.js" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
<Target Name="Restore" />
<!-- Override the default 'Build' target from eng/targets/Npm.Common.targets. -->
<Target Name="Build"
Inputs="@(WebpackInputs)"
Outputs="@(WebPackOutputs)">
<RemoveDir Directories="dist" />
<Yarn Command="run build:debug" />
<Yarn Command="run build:production" />
</Target>
</Project>

View File

@ -1,2 +0,0 @@
*.js -diff -merge
*.js linguist-generated=true

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,16 +5,14 @@
"description": "",
"main": "index.js",
"scripts": {
"preclean": "cd utils && yarn install --mutex network",
"clean": "node utils/node_modules/rimraf/bin.js node_modules",
"prebuild": "yarn run clean && yarn install --mutex network",
"build": "yarn run build:debug && yarn run build:production",
"build:debug": "cd src && webpack --mode development --config ./webpack.config.js",
"build:production": "cd src && webpack --mode production --config ./webpack.config.js",
"test": "jest"
},
"devDependencies": {
"@aspnet/signalr-protocol-msgpack": "file:../../SignalR/clients/ts/signalr-protocol-msgpack",
"@aspnet/signalr": "^1.0.0",
"@aspnet/signalr-protocol-msgpack": "^1.0.0",
"@dotnet/jsinterop": "3.0.0-preview6.19280.1",
"@types/emscripten": "0.0.31",
"@types/jest": "^24.0.6",

View File

@ -1,9 +0,0 @@
{
"name": "common",
"private": true,
"version": "0.0.1",
"description": "Common dependencies used during dev time. DO NOT PUBLISH",
"devDependencies": {
"rimraf": "^2.6.2"
}
}

View File

@ -1,82 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
glob@^7.1.3:
version "7.1.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
dependencies:
brace-expansion "^1.1.7"
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
rimraf@^2.6.2:
version "2.6.3"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
dependencies:
glob "^7.1.3"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=

View File

@ -2,13 +2,17 @@
# yarn lockfile v1
"@aspnet/signalr-protocol-msgpack@file:../../SignalR/clients/ts/signalr-protocol-msgpack":
version "3.0.0-dev"
"@aspnet/signalr-protocol-msgpack@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@aspnet/signalr-protocol-msgpack/-/signalr-protocol-msgpack-1.1.0.tgz#155038149e8e0eee1f97f4d1319f9f3271ff06fb"
integrity sha512-AQv5AavWvoFz2iLSIDK1DAIXMNhQ1Jt1qRDouXxLKAKP13u8iFq7i3/MwJ30ShOBGBoL5/zn6pBlNjAzTmAsMA==
dependencies:
msgpack5 "^4.0.2"
"@aspnet/signalr@file:../../SignalR/clients/ts/signalr":
version "3.0.0-dev"
"@aspnet/signalr@^1.0.0":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@aspnet/signalr/-/signalr-1.1.2.tgz#eb9cbc758ff5bfe9a2aba6669e05dfc25a6d783d"
integrity sha512-Xu2ndFTWYhyE+TOCK3LkPWGmc5xGLezBKgGEchyOA++alJ6fdWJ8P/Wsb4Mmd1buzcxGLlIyjpLfUP20rrCHIg==
dependencies:
eventsource "^1.0.7"
request "^2.88.0"

View File

@ -37,6 +37,11 @@
<span class="oi oi-list-rich" aria-hidden="true"></span> Error
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="links">
<span class="oi oi-list-rich" aria-hidden="true"></span> Links
</NavLink>
</li>
</ul>
</div>

View File

@ -41,8 +41,10 @@
"dist/**/*",
"src/**/*"
],
"peerDependencies": {
"@aspnet/signalr": "^1.0.0-preview3"
},
"dependencies": {
"@aspnet/signalr": "file:../signalr",
"msgpack5": "^4.0.2"
},
"devDependencies": {

View File

@ -3,19 +3,14 @@
<PropertyGroup>
<PackageId>@aspnet/signalr-protocol-msgpack</PackageId>
<IsPackable>!$(MSBuildProjectDirectory.Contains('node_modules'))</IsPackable>
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
<IsShippingPackage>!$(MSBuildProjectDirectory.Contains('node_modules'))</IsShippingPackage>
<IsBuildable>!$(MSBuildProjectDirectory.Contains('node_modules'))</IsBuildable>
<IsShippingPackage>true</IsShippingPackage>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\signalr\signalr.npmproj" />
</ItemGroup>
<ItemGroup>
<ReplacePackageContent Include="file:../signalr" ReplaceWith=">=$(PackageVersion)" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
</Project>

View File

@ -2,13 +2,6 @@
# yarn lockfile v1
"@aspnet/signalr@file:../signalr":
version "3.0.0-dev"
dependencies:
eventsource "^1.0.7"
request "^2.88.0"
ws "^6.0.0"
"@types/bl@*":
version "0.8.31"
resolved "https://registry.yarnpkg.com/@types/bl/-/bl-0.8.31.tgz#caa006702e13c36cda00345fa698b8d55c03113b"
@ -28,60 +21,11 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.5.tgz#6f9e8164ae1a55a9beb1d2571cfb7acf9d720c61"
integrity sha512-JRnfoh0Ll4ElmIXKxbUfcOodkGvcNHljct6mO1X9hE/mlrMzAx0hYCLAD7sgT53YAY1HdlpzUcV0CkmDqUqTuA==
ajv@^6.5.5:
version "6.10.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1"
integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==
dependencies:
fast-deep-equal "^2.0.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
asn1@~0.2.3:
version "0.2.4"
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"
integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==
dependencies:
safer-buffer "~2.1.0"
assert-plus@1.0.0, assert-plus@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=
async-limiter@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
aws-sign2@~0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=
aws4@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==
base64-js@^1.0.2:
version "1.2.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.1.tgz#a91947da1f4a516ea38e5b4ec0ec3773675e0886"
integrity sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==
bcrypt-pbkdf@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=
dependencies:
tweetnacl "^0.14.3"
bl@^1.2.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c"
@ -98,118 +42,11 @@ buffer@^5.0.8:
base64-js "^1.0.2"
ieee754 "^1.1.4"
caseless@~0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
combined-stream@^1.0.6, combined-stream@~1.0.6:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"
core-util-is@1.0.2, core-util-is@~1.0.0:
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=
dependencies:
assert-plus "^1.0.0"
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk=
ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=
dependencies:
jsbn "~0.1.0"
safer-buffer "^2.1.0"
eventsource@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-1.0.7.tgz#8fbc72c93fcd34088090bc0a4e64f4b5cee6d8d0"
integrity sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==
dependencies:
original "^1.0.0"
extend@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==
extsprintf@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05"
integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=
extsprintf@^1.2.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=
fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=
fast-json-stable-stringify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I=
forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=
form-data@~2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.6"
mime-types "^2.1.12"
getpass@^0.1.1:
version "0.1.7"
resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=
dependencies:
assert-plus "^1.0.0"
har-schema@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=
har-validator@~5.1.0:
version "5.1.3"
resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080"
integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==
dependencies:
ajv "^6.5.5"
har-schema "^2.0.0"
http-signature@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=
dependencies:
assert-plus "^1.0.0"
jsprim "^1.2.2"
sshpk "^1.7.0"
ieee754@^1.1.4:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
@ -220,63 +57,11 @@ inherits@^2.0.3, inherits@~2.0.3:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=
isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM=
json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
json-schema@0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"
integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=
json-stringify-safe@~5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
jsprim@^1.2.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=
dependencies:
assert-plus "1.0.0"
extsprintf "1.3.0"
json-schema "0.2.3"
verror "1.10.0"
mime-db@1.40.0:
version "1.40.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32"
integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==
mime-types@^2.1.12, mime-types@~2.1.19:
version "2.1.24"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81"
integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==
dependencies:
mime-db "1.40.0"
msgpack5@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/msgpack5/-/msgpack5-4.0.2.tgz#88be70e432d142b7a379bfb170f433bd41447508"
@ -287,53 +72,11 @@ msgpack5@^4.0.2:
readable-stream "^2.3.3"
safe-buffer "^5.1.1"
oauth-sign@~0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455"
integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==
original@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/original/-/original-1.0.2.tgz#e442a61cffe1c5fd20a65f3261c26663b303f25f"
integrity sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==
dependencies:
url-parse "^1.4.3"
performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
process-nextick-args@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa"
integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==
psl@^1.1.24:
version "1.1.31"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184"
integrity sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==
punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=
punycode@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
qs@~6.5.2:
version "6.5.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
querystringify@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e"
integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==
readable-stream@^2.3.3, readable-stream@^2.3.5:
version "2.3.6"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
@ -347,67 +90,11 @@ readable-stream@^2.3.3, readable-stream@^2.3.5:
string_decoder "~1.1.1"
util-deprecate "~1.0.1"
request@^2.88.0:
version "2.88.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"
integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==
dependencies:
aws-sign2 "~0.7.0"
aws4 "^1.8.0"
caseless "~0.12.0"
combined-stream "~1.0.6"
extend "~3.0.2"
forever-agent "~0.6.1"
form-data "~2.3.2"
har-validator "~5.1.0"
http-signature "~1.2.0"
is-typedarray "~1.0.0"
isstream "~0.1.2"
json-stringify-safe "~5.0.1"
mime-types "~2.1.19"
oauth-sign "~0.9.0"
performance-now "^2.1.0"
qs "~6.5.2"
safe-buffer "^5.1.2"
tough-cookie "~2.4.3"
tunnel-agent "^0.6.0"
uuid "^3.3.2"
requires-port@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
safe-buffer@^5.0.1, safe-buffer@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
integrity sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==
safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
sshpk@^1.7.0:
version "1.16.1"
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877"
integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==
dependencies:
asn1 "~0.2.3"
assert-plus "^1.0.0"
bcrypt-pbkdf "^1.0.0"
dashdash "^1.12.0"
ecc-jsbn "~0.1.1"
getpass "^0.1.1"
jsbn "~0.1.0"
safer-buffer "^2.0.2"
tweetnacl "~0.14.0"
string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
@ -415,63 +102,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"
tough-cookie@~2.4.3:
version "2.4.3"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781"
integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==
dependencies:
psl "^1.1.24"
punycode "^1.4.1"
tunnel-agent@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=
dependencies:
safe-buffer "^5.0.1"
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
uri-js@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==
dependencies:
punycode "^2.1.0"
url-parse@^1.4.3:
version "1.4.7"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278"
integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"
util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
uuid@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
verror@1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"
integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=
dependencies:
assert-plus "^1.0.0"
core-util-is "1.0.2"
extsprintf "^1.2.0"
ws@^6.0.0:
version "6.2.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb"
integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==
dependencies:
async-limiter "~1.0.0"

View File

@ -3,10 +3,9 @@
<PropertyGroup>
<PackageId>@aspnet/signalr</PackageId>
<IsPackable>!$(MSBuildProjectDirectory.Contains('node_modules'))</IsPackable>
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
<IsShippingPackage>!$(MSBuildProjectDirectory.Contains('node_modules'))</IsShippingPackage>
<IsBuildable>!$(MSBuildProjectDirectory.Contains('node_modules'))</IsBuildable>
<IsShippingPackage>true</IsShippingPackage>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />

View File

@ -63,7 +63,6 @@ export class HttpConnection implements IConnection {
private stopPromiseResolver!: (value?: PromiseLike<void>) => void;
private stopError?: Error;
private accessTokenFactory?: () => string | Promise<string>;
private sendQueue?: TransportSendQueue;
public readonly features: any = {};
public connectionId?: string;
@ -147,12 +146,8 @@ export class HttpConnection implements IConnection {
return Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State."));
}
if (!this.sendQueue) {
this.sendQueue = new TransportSendQueue(this.transport!);
}
// Transport will not be null if state is connected
return this.sendQueue.send(data);
return this.transport!.send(data);
}
public async stop(error?: Error): Promise<void> {
@ -194,11 +189,6 @@ export class HttpConnection implements IConnection {
// The transport should always be set if currently connected. If it wasn't set, it's likely because
// stop was called during start() and start() failed.
if (this.transport) {
if (this.sendQueue) {
this.sendQueue.stop();
this.sendQueue = undefined;
}
try {
await this.transport.stop();
} catch (e) {
@ -511,96 +501,3 @@ export class HttpConnection implements IConnection {
function transportMatches(requestedTransport: HttpTransportType | undefined, actualTransport: HttpTransportType) {
return !requestedTransport || ((actualTransport & requestedTransport) !== 0);
}
export class TransportSendQueue {
private buffer: any[] = [];
private sendBufferedData: PromiseSource;
private executing: boolean = true;
private transportResult: PromiseSource;
constructor(private readonly transport: ITransport) {
this.sendBufferedData = new PromiseSource();
this.transportResult = new PromiseSource();
// Suppress typescript error about handling Promises. The sendLoop doesn't need to be observed
this.sendLoop().then(() => {}, (_) => {});
}
public send(data: string | ArrayBuffer): Promise<void> {
this.bufferData(data);
return this.transportResult.promise;
}
public stop(): void {
this.executing = false;
this.sendBufferedData.resolve();
}
private bufferData(data: string | ArrayBuffer): void {
if (this.buffer.length && typeof(this.buffer[0]) !== typeof(data)) {
throw new Error(`Expected data to be of type ${typeof(this.buffer)} but was of type ${typeof(data)}`);
}
this.buffer.push(data);
this.sendBufferedData.resolve();
}
private async sendLoop(): Promise<void> {
while (true) {
await this.sendBufferedData.promise;
if (!this.executing) {
// Did we stop?
break;
}
this.sendBufferedData = new PromiseSource();
const transportResult = this.transportResult;
this.transportResult = new PromiseSource();
const data = typeof(this.buffer[0]) === "string" ?
this.buffer.join("") :
TransportSendQueue.concatBuffers(this.buffer);
this.buffer.length = 0;
try {
await this.transport.send(data);
transportResult.resolve();
} catch (error) {
transportResult.reject(error);
}
}
}
private static concatBuffers(arrayBuffers: ArrayBuffer[]): ArrayBuffer {
const totalLength = arrayBuffers.map((b) => b.byteLength).reduce((a, b) => a + b);
const result = new Uint8Array(totalLength);
let offset = 0;
for (const item of arrayBuffers) {
result.set(new Uint8Array(item), offset);
offset += item.byteLength;
}
return result;
}
}
class PromiseSource {
private resolver?: () => void;
private rejecter!: (reason?: any) => void;
public promise: Promise<void>;
constructor() {
this.promise = new Promise((resolve, reject) => [this.resolver, this.rejecter] = [resolve, reject]);
}
public resolve(): void {
this.resolver!();
}
public reject(reason?: any): void {
this.rejecter!(reason);
}
}

View File

@ -854,7 +854,7 @@ export class HubConnection {
private isObservable(arg: any): arg is IStreamResult<any> {
// This allows other stream implementations to just work (like rxjs)
return arg && arg.subscribe && typeof arg.subscribe === "function";
return arg.subscribe && typeof arg.subscribe === "function";
}
private createStreamInvocation(methodName: string, args: any[], streamIds: string[]): StreamInvocationMessage {

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
import { HttpResponse } from "../src/HttpClient";
import { HttpConnection, INegotiateResponse, TransportSendQueue } from "../src/HttpConnection";
import { HttpConnection, INegotiateResponse } from "../src/HttpConnection";
import { IHttpConnectionOptions } from "../src/IHttpConnectionOptions";
import { HttpTransportType, ITransport, TransferFormat } from "../src/ITransport";
@ -12,7 +12,6 @@ import { EventSourceConstructor, WebSocketConstructor } from "../src/Polyfills";
import { eachEndpointUrl, eachTransport, VerifyLogger } from "./Common";
import { TestHttpClient } from "./TestHttpClient";
import { TestTransport } from "./TestTransport";
import { PromiseSource, registerUnhandledRejectionHandler, SyncPoint } from "./Utils";
const commonOptions: IHttpConnectionOptions = {
@ -845,212 +844,3 @@ describe("HttpConnection", () => {
});
});
});
describe("TransportSendQueue", () => {
it("sends data when not currently sending", async () => {
const sendMock = jest.fn(() => Promise.resolve());
const transport = new TestTransport();
transport.send = sendMock;
const queue = new TransportSendQueue(transport);
await queue.send("Hello");
expect(sendMock.mock.calls.length).toBe(1);
queue.stop();
});
it("sends buffered data on fail", async () => {
const promiseSource1 = new PromiseSource();
const promiseSource2 = new PromiseSource();
const promiseSource3 = new PromiseSource();
const transport = new TestTransport();
const sendMock = jest.fn()
.mockImplementationOnce(async () => {
await promiseSource1;
promiseSource2.resolve();
await promiseSource3;
})
.mockImplementationOnce(() => Promise.resolve());
transport.send = sendMock;
const queue = new TransportSendQueue(transport);
const first = queue.send("Hello");
// This should allow first to enter transport.send
promiseSource1.resolve();
// Wait until we're inside transport.send
await promiseSource2;
// This should get queued.
const second = queue.send("world");
promiseSource3.reject();
let hasError = false;
try {
await first;
} catch {
hasError = true;
}
await second;
expect(hasError).toBe(true);
expect(sendMock.mock.calls.length).toBe(2);
expect(sendMock.mock.calls[0][0]).toEqual("Hello");
expect(sendMock.mock.calls[1][0]).toEqual("world");
queue.stop();
});
it("rejects promise for buffered sends", async () => {
const promiseSource1 = new PromiseSource();
const promiseSource2 = new PromiseSource();
const promiseSource3 = new PromiseSource();
const transport = new TestTransport();
const sendMock = jest.fn()
.mockImplementationOnce(async () => {
await promiseSource1;
promiseSource2.resolve();
await promiseSource3;
})
.mockImplementationOnce(() => Promise.reject());
transport.send = sendMock;
const queue = new TransportSendQueue(transport);
const first = queue.send("Hello");
// This should allow first to enter transport.send
promiseSource1.resolve();
// Wait until we're inside transport.send
await promiseSource2;
// This should get queued.
const second = queue.send("world");
promiseSource3.resolve();
await first;
let hasError = false;
try {
await second;
} catch {
hasError = true;
}
expect(hasError).toBe(true);
expect(sendMock.mock.calls.length).toBe(2);
expect(sendMock.mock.calls[0][0]).toEqual("Hello");
expect(sendMock.mock.calls[1][0]).toEqual("world");
queue.stop();
});
it ("concatenates string sends", async () => {
const promiseSource1 = new PromiseSource();
const promiseSource2 = new PromiseSource();
const promiseSource3 = new PromiseSource();
const transport = new TestTransport();
const sendMock = jest.fn()
.mockImplementationOnce(async () => {
await promiseSource1;
promiseSource2.resolve();
await promiseSource3;
})
.mockImplementationOnce(() => Promise.resolve());
transport.send = sendMock;
const queue = new TransportSendQueue(transport);
const first = queue.send("Hello");
// This should allow first to enter transport.send
promiseSource1.resolve();
// Wait until we're inside transport.send
await promiseSource2;
// These two operations should get queued.
const second = queue.send("world");
const third = queue.send("!");
promiseSource3.resolve();
await Promise.all([first, second, third]);
expect(sendMock.mock.calls.length).toBe(2);
expect(sendMock.mock.calls[0][0]).toEqual("Hello");
expect(sendMock.mock.calls[1][0]).toEqual("world!");
queue.stop();
});
it ("concatenates buffered ArrayBuffer", async () => {
const promiseSource1 = new PromiseSource();
const promiseSource2 = new PromiseSource();
const promiseSource3 = new PromiseSource();
const transport = new TestTransport();
const sendMock = jest.fn()
.mockImplementationOnce(async () => {
await promiseSource1;
promiseSource2.resolve();
await promiseSource3;
})
.mockImplementationOnce(() => Promise.resolve());
transport.send = sendMock;
const queue = new TransportSendQueue(transport);
const first = queue.send(new Uint8Array([4, 5, 6]));
// This should allow first to enter transport.send
promiseSource1.resolve();
// Wait until we're inside transport.send
await promiseSource2;
// These two operations should get queued.
const second = queue.send(new Uint8Array([7, 8, 10]));
const third = queue.send(new Uint8Array([12, 14]));
promiseSource3.resolve();
await Promise.all([first, second, third]);
expect(sendMock.mock.calls.length).toBe(2);
expect(sendMock.mock.calls[0][0]).toEqual(new Uint8Array([4, 5, 6]));
expect(sendMock.mock.calls[1][0]).toEqual(new Uint8Array([7, 8, 10, 12, 14]));
queue.stop();
});
it ("throws if mixed data is queued", async () => {
const promiseSource1 = new PromiseSource();
const promiseSource2 = new PromiseSource();
const promiseSource3 = new PromiseSource();
const transport = new TestTransport();
const sendMock = jest.fn()
.mockImplementationOnce(async () => {
await promiseSource1;
promiseSource2.resolve();
await promiseSource3;
})
.mockImplementationOnce(() => Promise.resolve());
transport.send = sendMock;
const queue = new TransportSendQueue(transport);
const first = queue.send(new Uint8Array([4, 5, 6]));
// This should allow first to enter transport.send
promiseSource1.resolve();
// Wait until we're inside transport.send
await promiseSource2;
// These two operations should get queued.
const second = queue.send(new Uint8Array([7, 8, 10]));
expect(() => queue.send("A string!")).toThrow();
promiseSource3.resolve();
await Promise.all([first, second]);
queue.stop();
});
});

View File

@ -123,35 +123,6 @@ describe("HubConnection", () => {
}
});
});
it("works if argument is null", async () => {
await VerifyLogger.run(async (logger) => {
const connection = new TestConnection();
const hubConnection = createHubConnection(connection, logger);
try {
// We don't actually care to wait for the send.
// tslint:disable-next-line:no-floating-promises
hubConnection.send("testMethod", "arg", null)
.catch((_) => { }); // Suppress exception and unhandled promise rejection warning.
// Verify the message is sent
expect(connection.sentData.length).toBe(1);
expect(JSON.parse(connection.sentData[0])).toEqual({
arguments: [
"arg",
null,
],
streamIds: [],
target: "testMethod",
type: MessageType.Invocation,
});
} finally {
// Close the connection
await hubConnection.stop();
}
});
});
});
describe("invoke", () => {

View File

@ -1,21 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
import { ITransport } from "signalr/src/ITransport";
export class TestTransport implements ITransport {
public connect() {
return Promise.resolve();
}
public send(): Promise<void> {
return Promise.resolve();
}
public stop(): Promise<void> {
return Promise.resolve();
}
public onreceive: ((data: string | ArrayBuffer) => void) | null = null;
public onclose: ((error?: Error | undefined) => void) | null = null;
}