diff --git a/.gitignore b/.gitignore index 7e9bd19a60..6b6d03cf63 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,5 @@ jquery.signalR.min.js xamarin/SignalRPackage/component/lib/mobile/ tests/Microsoft.AspNet.SignalR.Client.Store.Tests/AppPackages/ /Microsoft.AspNet.SignalR.sln.ide -<<<<<<< HEAD /.vs/ -.lock.json \ No newline at end of file +project.lock.json \ No newline at end of file diff --git a/src/Microsoft.AspNet.SignalR.Client.Store/Microsoft.AspNet.SignalR.Client.Store.csproj b/src/Microsoft.AspNet.SignalR.Client.Store/Microsoft.AspNet.SignalR.Client.Store.csproj index e6ac21985b..1cd9adea80 100644 --- a/src/Microsoft.AspNet.SignalR.Client.Store/Microsoft.AspNet.SignalR.Client.Store.csproj +++ b/src/Microsoft.AspNet.SignalR.Client.Store/Microsoft.AspNet.SignalR.Client.Store.csproj @@ -57,7 +57,7 @@ Properties\CommonVersionInfo.cs - + diff --git a/src/Microsoft.AspNet.SignalR.Client.Store/Resources.cs b/src/Microsoft.AspNet.SignalR.Client.Store/ResourcesStore.cs similarity index 93% rename from src/Microsoft.AspNet.SignalR.Client.Store/Resources.cs rename to src/Microsoft.AspNet.SignalR.Client.Store/ResourcesStore.cs index 56d29d705e..8b55b74445 100644 --- a/src/Microsoft.AspNet.SignalR.Client.Store/Resources.cs +++ b/src/Microsoft.AspNet.SignalR.Client.Store/ResourcesStore.cs @@ -4,7 +4,7 @@ namespace Microsoft.AspNet.SignalR.Client { - internal class Resources + internal static class ResourcesStore { private static readonly ResourceLoader ResourceLoader = ResourceLoader.GetForViewIndependentUse("Microsoft.AspNet.SignalR.Client.Store/Resources"); diff --git a/src/Microsoft.AspNet.SignalR.Client.Store/Transports/WebSocketTransport.cs b/src/Microsoft.AspNet.SignalR.Client.Store/Transports/WebSocketTransport.cs index 2f4f3c1bf2..77f561d0cb 100644 --- a/src/Microsoft.AspNet.SignalR.Client.Store/Transports/WebSocketTransport.cs +++ b/src/Microsoft.AspNet.SignalR.Client.Store/Transports/WebSocketTransport.cs @@ -153,12 +153,12 @@ public override Task Send(IConnection connection, string data, string connection if (connection.State != ConnectionState.Disconnected) { // Make this a faulted task and trigger the OnError even to maintain consistency with the HttpBasedTransports - ex = new InvalidOperationException(Resources.GetResourceString("Error_DataCannotBeSentDuringWebSocketReconnect")); + ex = new InvalidOperationException(ResourcesStore.GetResourceString("Error_DataCannotBeSentDuringWebSocketReconnect")); connection.OnError(ex); } else { - ex = new InvalidOperationException(Resources.GetResourceString("Error_WebSocketUninitialized")); + ex = new InvalidOperationException(ResourcesStore.GetResourceString("Error_DataCannotBeSentDuringWebSocketReconnect")); } var tcs = new TaskCompletionSource(); diff --git a/src/Microsoft.AspNet.SignalR.Client.UWP/Microsoft.AspNet.SignalR.Client.UWP.csproj b/src/Microsoft.AspNet.SignalR.Client.UWP/Microsoft.AspNet.SignalR.Client.UWP.csproj index ba656cf988..160bc3c92b 100644 --- a/src/Microsoft.AspNet.SignalR.Client.UWP/Microsoft.AspNet.SignalR.Client.UWP.csproj +++ b/src/Microsoft.AspNet.SignalR.Client.UWP/Microsoft.AspNet.SignalR.Client.UWP.csproj @@ -11,7 +11,7 @@ Microsoft.AspNet.SignalR.Client en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 512 @@ -314,12 +314,24 @@ Infrastructure\TaskAsyncHelper.cs + + Transports\WebSockets\IWebSocketResponse.cs + + + Transports\WebSockets\MessageReceivedEventArgsWrapper.cs + + + Transports\WebSockets\WebSocketRequest.cs + + + Transports\WebSockets\WebSocketTransport.cs + + - - Resources.resx - + + 14.0 @@ -328,6 +340,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The underlying WebSocket is not initialized. Call the 'Start' method to initialize the WebSocket. + + + Data cannot be sent because the WebSocket connection is reconnecting. + + \ No newline at end of file diff --git a/src/Microsoft.AspNet.SignalR.Client/Http/HttpHelper.cs b/src/Microsoft.AspNet.SignalR.Client/Http/HttpHelper.cs index 7774c1c947..a6df5d8603 100644 --- a/src/Microsoft.AspNet.SignalR.Client/Http/HttpHelper.cs +++ b/src/Microsoft.AspNet.SignalR.Client/Http/HttpHelper.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.IO; using System.Net; using System.Text; @@ -102,7 +103,7 @@ public static byte[] ProcessPostData(IDictionary postData) continue; } - sb.AppendFormat("{0}={1}", pair.Key, UrlEncoder.UrlEncode(pair.Value)); + sb.AppendFormat(CultureInfo.InvariantCulture, "{0}={1}", pair.Key, UrlEncoder.UrlEncode(pair.Value)); } return Encoding.UTF8.GetBytes(sb.ToString()); diff --git a/src/Microsoft.AspNet.SignalR.Client/Transports/AutoTransport.cs b/src/Microsoft.AspNet.SignalR.Client/Transports/AutoTransport.cs index fe01eec8da..514ad7cb5c 100644 --- a/src/Microsoft.AspNet.SignalR.Client/Transports/AutoTransport.cs +++ b/src/Microsoft.AspNet.SignalR.Client/Transports/AutoTransport.cs @@ -27,7 +27,7 @@ public AutoTransport(IHttpClient httpClient) _transports = new List() { -#if NET45 +#if NET45 || WINDOWS_UWP new WebSocketTransport(httpClient), #endif new ServerSentEventsTransport(httpClient), diff --git a/tests/Microsoft.AspNet.SignalR.Client.Store.Tests/FunctionalTests/EndToEndTests.cs b/tests/Microsoft.AspNet.SignalR.Client.Store.Tests/FunctionalTests/EndToEndTests.cs index ae3d730019..1180ada8f9 100644 --- a/tests/Microsoft.AspNet.SignalR.Client.Store.Tests/FunctionalTests/EndToEndTests.cs +++ b/tests/Microsoft.AspNet.SignalR.Client.Store.Tests/FunctionalTests/EndToEndTests.cs @@ -7,7 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Xunit; -using StoreClientResources = StoreClient::Microsoft.AspNet.SignalR.Client.Resources; +using StoreClientResources = StoreClient::Microsoft.AspNet.SignalR.Client.ResourcesStore; namespace Microsoft.AspNet.SignalR.Client.Store.Tests { @@ -92,7 +92,7 @@ public async Task WebSocketReconnects() Assert.True(reconnectingInvoked); Assert.Equal(ConnectionState.Connected, hubConnection.State); - // TODO: this is a workaround to a race condition in WebSocket. + // TODO: this is a workaround to a race condition in WebSocket. // Should be removed once the race in WebSockets is fixed await Task.Delay(200); @@ -131,7 +131,7 @@ public async Task WebSocketReconnectsIfConnectionLost() if (stateChange.OldState == ConnectionState.Connected && stateChange.NewState == ConnectionState.Reconnecting) { - // Reverting quick timeout + // Reverting quick timeout ((IConnection) hubConnection).KeepAliveData = new KeepAliveData( timeoutWarning: TimeSpan.FromSeconds(30), timeout: TimeSpan.FromSeconds(20), @@ -161,7 +161,7 @@ public async Task WebSocketReconnectsIfConnectionLost() Assert.True(await Task.Run(() => reconnectedWh.Wait(5000))); - // TODO: this is a workaround to a race condition in WebSocket. + // TODO: this is a workaround to a race condition in WebSocket. // Should be removed once the race in WebSockets is fixed await Task.Delay(200); diff --git a/tests/Microsoft.AspNet.SignalR.Client.Store.Tests/Transports/WebSocketTransportFacts.cs b/tests/Microsoft.AspNet.SignalR.Client.Store.Tests/Transports/WebSocketTransportFacts.cs index 08357fdb62..47d8cae720 100644 --- a/tests/Microsoft.AspNet.SignalR.Client.Store.Tests/Transports/WebSocketTransportFacts.cs +++ b/tests/Microsoft.AspNet.SignalR.Client.Store.Tests/Transports/WebSocketTransportFacts.cs @@ -200,7 +200,7 @@ public async Task CannotInvokeSendIfWebSocketUnitialized() var fakeConnection = new FakeConnection {State = ConnectionState.Disconnected}; Assert.Equal( - StoreClient::Microsoft.AspNet.SignalR.Client.Resources.GetResourceString("Error_WebSocketUninitialized"), + StoreClient::Microsoft.AspNet.SignalR.Client.ResourcesStore.GetResourceString("Error_WebSocketUninitialized"), (await Assert.ThrowsAsync( async () => await new WebSocketTransport().Send(fakeConnection, null, null))).Message); }