Permalink
Browse files

Adding client for .net 3.5

  • Loading branch information...
1 parent 7ba2c26 commit 9e3a95c65fa64ee149e5929318dc6faacc37ef2e @robink-teleopti robink-teleopti committed with davidfowl Jun 4, 2012
View
18 SignalR.Client.Net35/IObserver.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace SignalR.Client
+{
+ public interface IObserver<T>
+ {
+ void OnCompleted();
+ void OnError(Exception exception);
+ void OnNext(T value);
+ }
+
+ public interface IObservable<T>
+ {
+ }
+}
View
4 SignalR.Client.Net35/Properties/AssemblyInfo.cs
@@ -0,0 +1,4 @@
+using System.Reflection;
+
+[assembly: AssemblyTitle("SignalR.Client.Net35")]
+[assembly: AssemblyDescription(".NET 3.5 client for SignalR")]
View
12 SignalR.Client.Net35/Properties/SignalR.Client.Net35.nuspec
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>$id$</id>
+ <version>$version$</version>
+ <authors>$author$</authors>
+ <description>$description$</description>
+ <licenseUrl>https://github.com/SignalR/SignalR/blob/master/LICENSE.md</licenseUrl>
+ <projectUrl>https://github.com/SignalR/SignalR</projectUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ </metadata>
+</package>
View
3 SignalR.Client.Net35/Properties/VersionInfo.cs
@@ -0,0 +1,3 @@
+using System.Reflection;
+
+[assembly: AssemblyVersion("0.5.1.0")]
View
170 SignalR.Client.Net35/SignalR.Client.Net35.csproj
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{42DE29B3-67CA-4003-A4F6-CA4F21C8991C}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SignalR.Client.Net35</RootNamespace>
+ <AssemblyName>SignalR.Client.Net35</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;NET35</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE;NET35</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\packages\Newtonsoft.Json.4.5.6\lib\net35\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Threading.Tasks.NET35">
+ <HintPath>..\packages\System.Threading.Tasks.3.0.1\lib\net35\System.Threading.Tasks.NET35.dll</HintPath>
+ <Aliases>global</Aliases>
+ </Reference>
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\Common\CommonAssemblyInfo.cs">
+ <Link>Properties\CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Connection.cs">
+ <Link>Connection.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\ConnectionExtensions.cs">
+ <Link>ConnectionExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\ConnectionState.cs">
+ <Link>ConnectionState.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Http\DefaultHttpClient.cs">
+ <Link>Http\DefaultHttpClient.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Http\HttpHelper.cs">
+ <Link>Http\HttpHelper.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Http\HttpWebRequestWrapper.cs">
+ <Link>Http\HttpWebRequestWrapper.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Http\HttpWebResponseWrapper.cs">
+ <Link>Http\HttpWebResponseWrapper.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Http\IHttpClient.cs">
+ <Link>Http\IHttpClient.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Http\IHttpClientExtensions.cs">
+ <Link>Http\IHttpClientExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Http\IRequest.cs">
+ <Link>Http\IRequest.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Http\IResponse.cs">
+ <Link>Http\IResponse.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\HubConnection.cs">
+ <Link>Hubs\HubConnection.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\HubInvocation.cs">
+ <Link>Hubs\HubInvocation.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\HubProxy.cs">
+ <Link>Hubs\HubProxy.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\HubProxyExtensions.cs">
+ <Link>Hubs\HubProxyExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\HubRegistrationData.cs">
+ <Link>Hubs\HubRegistrationData.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\HubResult.cs">
+ <Link>Hubs\HubResult.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\Hubservable.cs">
+ <Link>Hubs\Hubservable.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\IHubProxy.cs">
+ <Link>Hubs\IHubProxy.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Hubs\Subscription.cs">
+ <Link>Hubs\Subscription.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\IConnection.cs">
+ <Link>IConnection.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Infrastructure\ChunkBuffer.cs">
+ <Link>Infrastructure\ChunkBuffer.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Infrastructure\DisposableAction.cs">
+ <Link>Infrastructure\DisposableAction.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Infrastructure\StreamExtensions.cs">
+ <Link>Infrastructure\StreamExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\NegotiationResponse.cs">
+ <Link>NegotiationResponse.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\ObservableConnection.cs">
+ <Link>ObservableConnection.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Transports\AutoTransport.cs">
+ <Link>Transports\AutoTransport.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Transports\HttpBasedTransport.cs">
+ <Link>Transports\HttpBasedTransport.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Transports\IClientTransport.cs">
+ <Link>Transports\IClientTransport.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Transports\LongPollingTransport.cs">
+ <Link>Transports\LongPollingTransport.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Client\Transports\ServerSentEventsTransport.cs">
+ <Link>Transports\ServerSentEventsTransport.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR.Hosting.Common\Infrastructure\UriQueryUtility.cs">
+ <Link>Infrastructure\UriQueryUtility.cs</Link>
+ </Compile>
+ <Compile Include="..\SignalR\TaskAsyncHelper.cs">
+ <Link>Infrastructure\TaskAsyncHelper.cs</Link>
+ </Compile>
+ <Compile Include="IObserver.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Properties\VersionInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ <None Include="Properties\SignalR.Client.Net35.nuspec">
+ <SubType>Designer</SubType>
+ </None>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
5 SignalR.Client.Net35/packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Newtonsoft.Json" version="4.5.6" />
+ <package id="System.Threading.Tasks" version="3.0.1" />
+</packages>
View
2 SignalR.Client/Connection.cs
@@ -408,7 +408,7 @@ private static string CreateUserAgentString(string client)
private static bool TryParseVersion(string versionString, out Version version)
{
-#if WINDOWS_PHONE
+#if WINDOWS_PHONE || NET35
try
{
version = new Version(versionString);
View
6 SignalR.Client/Http/HttpHelper.cs
@@ -88,7 +88,11 @@ public static string ReadAsString(this HttpWebResponse response)
}
catch (Exception ex)
{
- Debug.WriteLine("Failed to read resonse: {0}", ex);
+#if NET35
+ Debug.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Failed to read response: {0}", ex));
+#else
+ Debug.WriteLine("Failed to read response: {0}", ex);
+#endif
// Swallow exceptions when reading the response stream and just try again.
return null;
}
View
6 SignalR.Client/Hubs/HubProxy.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-#if !WINDOWS_PHONE
+#if !WINDOWS_PHONE && !NET35
using System.Dynamic;
#endif
using System.Threading.Tasks;
@@ -9,7 +9,7 @@
namespace SignalR.Client.Hubs
{
public class HubProxy :
-#if !WINDOWS_PHONE
+#if !WINDOWS_PHONE && !NET35
DynamicObject,
#endif
IHubProxy
@@ -101,7 +101,7 @@ public Task<T> Invoke<T>(string method, params object[] args)
});
}
-#if !WINDOWS_PHONE
+#if !WINDOWS_PHONE && !NET35
public override bool TrySetMember(SetMemberBinder binder, object value)
{
_state[binder.Name] = value;
View
2 SignalR.Client/Hubs/HubProxyExtensions.cs
@@ -133,7 +133,7 @@ public static IDisposable On<T>(this IHubProxy proxy, string eventName, Action<T
return new DisposableAction(() => subscription.Data -= handler);
}
-#if !WINDOWS_PHONE && !SILVERLIGHT
+#if !WINDOWS_PHONE && !SILVERLIGHT && !NET35
/// <summary>
/// Registers for an event with the specified name and callback
/// </summary>
View
4 SignalR.Client/Transports/AutoTransport.cs
@@ -50,7 +50,11 @@ private void ResolveTransport(IConnection connection, CancellationToken cancella
#if !WINDOWS_PHONE && !SILVERLIGHT && !NETFX_CORE
Trace.TraceError("SignalR exception thrown by Task: {0}", ex);
#endif
+#if NET35
+ Debug.WriteLine(System.String.Format(System.Globalization.CultureInfo.InvariantCulture, "Auto: Failed to connect to using transport {0}", (object)transport.GetType().Name));
+#else
Debug.WriteLine("Auto: Failed to connect to using transport {0}", (object)transport.GetType().Name);
+#endif
// If that transport fails to initialize then fallback
var next = index + 1;
View
9 SignalR.Client/Transports/HttpBasedTransport.cs
@@ -226,7 +226,12 @@ protected static void ProcessResponse(IConnection connection, string response, o
}
catch (Exception ex)
{
+#if NET35
+ Debug.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Failed to process message: {0}", ex));
+#else
Debug.WriteLine("Failed to process message: {0}", ex);
+#endif
+
connection.OnError(ex);
}
}
@@ -247,7 +252,11 @@ protected static void ProcessResponse(IConnection connection, string response, o
}
catch (Exception ex)
{
+#if NET35
+ Debug.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Failed to response: {0}", ex));
+#else
Debug.WriteLine("Failed to response: {0}", ex);
+#endif
connection.OnError(ex);
}
}
View
8 SignalR.Client/Transports/LongPollingTransport.cs
@@ -51,7 +51,11 @@ private void PollingLoop(IConnection connection, string data, Action initializeC
url += GetReceiveQueryString(connection, data);
+#if NET35
+ Debug.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "LP: {0}", (object)url));
+#else
Debug.WriteLine("LP: {0}", (object)url);
+#endif
_httpClient.PostAsync(url, PrepareRequest(connection)).ContinueWith(task =>
{
@@ -75,7 +79,11 @@ private void PollingLoop(IConnection connection, string data, Action initializeC
// Get the response
var raw = task.Result.ReadAsString();
+#if NET35
+ Debug.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "LP Receive: {0}", (object)raw));
+#else
Debug.WriteLine("LP Receive: {0}", (object)raw);
+#endif
ProcessResponse(connection, raw, out shouldRaiseReconnect, out disconnectedReceived);
}
View
2 SignalR.Client/Transports/ServerSentEvents/ChunkBuffer.cs
@@ -38,7 +38,7 @@ public string ReadLine()
_buffer.Remove(0, _offset + 1);
string line = _lineBuilder.ToString();
-#if WINDOWS_PHONE
+#if WINDOWS_PHONE || NET35
_lineBuilder.Length = 0;
#else
_lineBuilder.Clear();
View
4 SignalR.Client/Transports/ServerSentEventsTransport.cs
@@ -59,7 +59,11 @@ private void OpenConnection(IConnection connection, string data, Action initiali
Action<IRequest> prepareRequest = PrepareRequest(connection);
+#if NET35
+ Debug.WriteLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "SSE: GET {0}", (object)url));
+#else
Debug.WriteLine("SSE: GET {0}", (object)url);
+#endif
_httpClient.GetAsync(url, request =>
{
View
25 SignalR.sln
@@ -48,6 +48,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{08B794
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignalR.ProxyGenerator", "SignalR.ProxyGenerator\SignalR.ProxyGenerator.csproj", "{12609D9C-B4C9-4553-B364-D2C297F85CE7}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignalR.Client.Net35", "SignalR.Client.Net35\SignalR.Client.Net35.csproj", "{42DE29B3-67CA-4003-A4F6-CA4F21C8991C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignalR.Client.Net35.Samples", "samples\SignalR.Client.Net35.Samples\SignalR.Client.Net35.Samples.csproj", "{9A64F050-8F95-46B2-906C-0BFCA7A27E94}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -200,6 +204,26 @@ Global
{12609D9C-B4C9-4553-B364-D2C297F85CE7}.Release|Mixed Platforms.Build.0 = Release|x86
{12609D9C-B4C9-4553-B364-D2C297F85CE7}.Release|x86.ActiveCfg = Release|x86
{12609D9C-B4C9-4553-B364-D2C297F85CE7}.Release|x86.Build.0 = Release|x86
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {42DE29B3-67CA-4003-A4F6-CA4F21C8991C}.Release|x86.ActiveCfg = Release|Any CPU
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Debug|x86.ActiveCfg = Debug|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Debug|x86.Build.0 = Debug|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Release|Any CPU.ActiveCfg = Release|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Release|Mixed Platforms.Build.0 = Release|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Release|x86.ActiveCfg = Release|x86
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -210,5 +234,6 @@ Global
{8BF43A5B-4C96-4490-A9AF-5A057AC37C24} = {7E3D992A-8F37-4C5D-AD42-E052522816C5}
{8FD9E25A-2268-4F6E-85F3-B83DC018ECE9} = {7E3D992A-8F37-4C5D-AD42-E052522816C5}
{E0223FDC-0982-4D80-B6C2-BFAA6C6748C5} = {7E3D992A-8F37-4C5D-AD42-E052522816C5}
+ {9A64F050-8F95-46B2-906C-0BFCA7A27E94} = {7E3D992A-8F37-4C5D-AD42-E052522816C5}
EndGlobalSection
EndGlobal
View
17 SignalR/TaskAsyncHelper.cs
@@ -437,6 +437,23 @@ public static Task Delay(TimeSpan timeOut)
{
#if NETFX_CORE
return Task.Delay(timeOut);
+#elif NET35
+ var tcs = new TaskCompletionSource<object>();
+
+ var assemblyName = typeof (Task).Assembly.FullName;
+ var timerCallbackType = Type.GetType("System.Threading.TimerCallback, " + assemblyName);
+ var timerType = Type.GetType("System.Threading.Timer, " + assemblyName);
+ var construct = timerType.GetConstructor(new[]{timerCallbackType,typeof(Object),typeof(TimeSpan),typeof(TimeSpan)});
+
+ Delegate delegateInstance = Delegate.CreateDelegate(timerCallbackType, tcs, "SetResult");
+
+ var timer = (IDisposable)construct.Invoke(new object[]{ delegateInstance, null, timeOut, TimeSpan.FromMilliseconds(-1)});
+
+ return tcs.Task.ContinueWith(_ =>
+ {
+ timer.Dispose();
+ },
+ TaskContinuationOptions.ExecuteSynchronously);
#else
var tcs = new TaskCompletionSource<object>();
View
68 samples/SignalR.Client.Net35.Samples/Program.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using SignalR.Client.Hubs;
+
+namespace SignalR.Client.Net35.Samples
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var hubConnection = new HubConnection("http://localhost:40476/");
+
+ RunDemoHub(hubConnection);
+
+ RunStreamingSample();
+
+ Console.ReadKey();
+ }
+
+ private static void RunDemoHub(HubConnection hubConnection)
+ {
+ var demo = hubConnection.CreateProxy("demo");
+
+ demo.On<int>("invoke", i =>
+ {
+ Console.WriteLine("{0} client state index -> {1}", i, demo["index"]);
+ });
+
+ hubConnection.Start().Wait();
+
+
+ demo.Invoke("multipleCalls").ContinueWith(task =>
+ {
+ Console.WriteLine(task.Exception);
+
+ }, TaskContinuationOptions.OnlyOnFaulted);
+
+ Task.Factory.StartNew(() =>
+ {
+ Thread.Sleep(7000);
+ hubConnection.Stop();
+ });
+ }
+
+ private static void RunStreamingSample()
+ {
+ var connection = new Connection("http://localhost:40476/Raw/raw");
+
+ connection.Received += data =>
+ {
+ Console.WriteLine(data);
+ };
+
+ connection.Reconnected += () =>
+ {
+ Console.WriteLine("[{0}]: Connection restablished", DateTime.Now);
+ };
+
+ connection.Error += e =>
+ {
+ Console.WriteLine(e);
+ };
+
+ connection.Start().Wait();
+ }
+ }
+}
View
36 samples/SignalR.Client.Net35.Samples/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SignalR.Client.Net35.Samples")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SignalR.Client.Net35.Samples")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("1407cfba-0b6a-4246-9693-df3157e440e9")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
68 samples/SignalR.Client.Net35.Samples/SignalR.Client.Net35.Samples.csproj
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9A64F050-8F95-46B2-906C-0BFCA7A27E94}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SignalR.Client.Net35.Samples</RootNamespace>
+ <AssemblyName>SignalR.Client.Net35.Samples</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Threading.Tasks.NET35">
+ <HintPath>..\..\packages\System.Threading.Tasks.3.0.1\lib\net35\System.Threading.Tasks.NET35.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\SignalR.Client.Net35\SignalR.Client.Net35.csproj">
+ <Project>{42DE29B3-67CA-4003-A4F6-CA4F21C8991C}</Project>
+ <Name>SignalR.Client.Net35</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
4 samples/SignalR.Client.Net35.Samples/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="System.Threading.Tasks" version="3.0.1" />
+</packages>
View
6 samples/SignalR.Hosting.AspNet.Samples/Scripts/hubs.js
@@ -171,7 +171,7 @@
demo: {
_: {
hubName: 'demo',
- ignoreMembers: ['addToGroups', 'complexArray', 'complexType', 'doSomethingAndCallError', 'dynamicTask', 'genericTaskTypedAsPlain', 'genericTaskWithException', 'getValue', 'multipleCalls', 'overload', 'passingDynamicComplex', 'plainTask', 'readStateValue', 'setStateValue', 'simpleArray', 'taskWithException', 'unsupportedOverload', 'namespace', 'ignoreMembers', 'callbacks'],
+ ignoreMembers: ['addToGroups', 'complexArray', 'complexType', 'doSomethingAndCallError', 'dynamicTask', 'genericTaskTypedAsPlain', 'genericTaskWithException', 'getValue', 'multipleCalls', 'overload', 'passingDynamicComplex', 'plainTask', 'readStateValue', 'simpleArray', 'taskWithException', 'unsupportedOverload', 'namespace', 'ignoreMembers', 'callbacks'],
connection: function () { return signalR.hub; }
},
@@ -215,10 +215,6 @@
return serverCall(this, "ReadStateValue", $.makeArray(arguments));
},
- setStateValue: function (value, callback) {
- return serverCall(this, "SetStateValue", $.makeArray(arguments));
- },
-
complexArray: function (people, callback) {
return serverCall(this, "ComplexArray", $.makeArray(arguments));
},

0 comments on commit 9e3a95c

Please sign in to comment.