Skip to content

Commit

Permalink
Merge pull request #220 from Code-Sharp/develop
Browse files Browse the repository at this point in the history
Adding .NETStandard2.0 support
  • Loading branch information
darkl authored Nov 25, 2017
2 parents 233e979 + 710b362 commit f7f71bb
Show file tree
Hide file tree
Showing 35 changed files with 643 additions and 57 deletions.
2 changes: 2 additions & 0 deletions NuGet/WampSharp.AspNetCore.WebSockets.Server.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
<files>
<file src="$bin$\netstandard1.3\WampSharp.AspNetCore.WebSockets.Server.dll" target="lib\netstandard1.3\WampSharp.AspNetCore.WebSockets.Server.dll" />
<file src="$bin$\netstandard1.3\WampSharp.AspNetCore.WebSockets.Server.xml" target="lib\netstandard1.3\WampSharp.AspNetCore.WebSockets.Server.xml" />
<file src="$bin$\netstandard2.0\WampSharp.AspNetCore.WebSockets.Server.dll" target="lib\netstandard2.0\WampSharp.AspNetCore.WebSockets.Server.dll" />
<file src="$bin$\netstandard2.0\WampSharp.AspNetCore.WebSockets.Server.xml" target="lib\netstandard2.0\WampSharp.AspNetCore.WebSockets.Server.xml" />
</files>
</package>
7 changes: 7 additions & 0 deletions NuGet/WampSharp.Default.Client.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<dependency id="WampSharp.NewtonsoftMsgpack" version="[$version$]" />
<dependency id="WampSharp.WebSockets" version="[$version$]" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="WampSharp.NewtonsoftJson" version="[$version$]" />
<dependency id="WampSharp.NewtonsoftMsgpack" version="[$version$]" />
<dependency id="WampSharp.WebSockets" version="[$version$]" />
</group>
</dependencies>
<id>WampSharp.Default.Client</id>
<title>WampSharp default client binding</title>
Expand All @@ -47,5 +52,7 @@
<file src="$bin$\uap10.0\WampSharp.Default.Client.xml" target="lib\uap10.0\WampSharp.Default.Client.xml" />
<file src="$bin$\netstandard1.3\WampSharp.Default.Client.dll" target="lib\netstandard1.3\WampSharp.Default.Client.dll" />
<file src="$bin$\netstandard1.3\WampSharp.Default.Client.xml" target="lib\netstandard1.3\WampSharp.Default.Client.xml" />
<file src="$bin$\netstandard2.0\WampSharp.Default.Client.dll" target="lib\netstandard2.0\WampSharp.Default.Client.dll" />
<file src="$bin$\netstandard2.0\WampSharp.Default.Client.xml" target="lib\netstandard2.0\WampSharp.Default.Client.xml" />
</files>
</package>
3 changes: 3 additions & 0 deletions NuGet/WampSharp.Default.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<group targetFramework=".NETStandard1.3">
<dependency id="WampSharp.Default.Client" version="[$version$]" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="WampSharp.Default.Client" version="[$version$]" />
</group>
</dependencies>
<id>WampSharp.Default</id>
<title>WampSharp default binding</title>
Expand Down
6 changes: 6 additions & 0 deletions NuGet/WampSharp.NewtonsoftJson.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
<dependency id="WampSharp" version="[$version$]" />
<dependency id="Newtonsoft.Json" version="[9.0.1, )" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="WampSharp" version="[$version$]" />
<dependency id="Newtonsoft.Json" version="[9.0.1, )" />
</group>
<group targetFramework="uap10.0">
<dependency id="WampSharp" version="[$version$]" />
<dependency id="Newtonsoft.Json" version="[9.0.1, )" />
Expand All @@ -42,5 +46,7 @@
<file src="$bin$\pcl\WampSharp.NewtonsoftJson.xml" target="lib\portable-win81+wpa81\WampSharp.NewtonsoftJson.xml" />
<file src="$bin$\netstandard1.3\WampSharp.NewtonsoftJson.dll" target="lib\netstandard1.3\WampSharp.NewtonsoftJson.dll" />
<file src="$bin$\netstandard1.3\WampSharp.NewtonsoftJson.xml" target="lib\netstandard1.3\WampSharp.NewtonsoftJson.xml" />
<file src="$bin$\netstandard2.0\WampSharp.NewtonsoftJson.dll" target="lib\netstandard2.0\WampSharp.NewtonsoftJson.dll" />
<file src="$bin$\netstandard2.0\WampSharp.NewtonsoftJson.xml" target="lib\netstandard2.0\WampSharp.NewtonsoftJson.xml" />
</files>
</package>
7 changes: 7 additions & 0 deletions NuGet/WampSharp.NewtonsoftMsgpack.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<dependency id="WampSharp.NewtonsoftJson" version="[$version$]" />
<dependency id="Newtonsoft.Msgpack" version="[0.1.10,)" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="WampSharp" version="[$version$]" />
<dependency id="WampSharp.NewtonsoftJson" version="[$version$]" />
<dependency id="Newtonsoft.Msgpack" version="[0.1.10,)" />
</group>
</dependencies>
<id>WampSharp.NewtonsoftMsgpack</id>
<title>WampSharp Newtonsoft.Msgpack binding</title>
Expand All @@ -35,5 +40,7 @@
<file src="$bin$\net40\WampSharp.NewtonsoftMsgpack.xml" target="lib\net40\WampSharp.NewtonsoftMsgpack.xml" />
<file src="$bin$\net45\WampSharp.NewtonsoftMsgpack.dll" target="lib\netstandard1.3\WampSharp.NewtonsoftMsgpack.dll" />
<file src="$bin$\net45\WampSharp.NewtonsoftMsgpack.xml" target="lib\netstandard1.3\WampSharp.NewtonsoftMsgpack.xml" />
<file src="$bin$\net45\WampSharp.NewtonsoftMsgpack.dll" target="lib\netstandard2.0\WampSharp.NewtonsoftMsgpack.dll" />
<file src="$bin$\net45\WampSharp.NewtonsoftMsgpack.xml" target="lib\netstandard2.0\WampSharp.NewtonsoftMsgpack.xml" />
</files>
</package>
6 changes: 6 additions & 0 deletions NuGet/WampSharp.RawSocket.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<dependency id="System.Buffers" version="4.3.0" />
<dependency id="System.Net.Sockets" version="4.3.0" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="WampSharp" version="[$version$]" />
<dependency id="System.Buffers" version="4.3.0" />
</group>
</dependencies>
<id>WampSharp.RawSocket</id>
<title>WampSharp RawSocket support</title>
Expand All @@ -27,5 +31,7 @@
<file src="$bin$\net45\WampSharp.RawSocket.xml" target="lib\net45\WampSharp.RawSocket.xml" />
<file src="$bin$\netstandard1.3\WampSharp.RawSocket.dll" target="lib\netstandard1.3\WampSharp.RawSocket.dll" />
<file src="$bin$\netstandard1.3\WampSharp.RawSocket.xml" target="lib\netstandard1.3\WampSharp.RawSocket.xml" />
<file src="$bin$\netstandard2.0\WampSharp.RawSocket.dll" target="lib\netstandard2.0\WampSharp.RawSocket.dll" />
<file src="$bin$\netstandard2.0\WampSharp.RawSocket.xml" target="lib\netstandard2.0\WampSharp.RawSocket.xml" />
</files>
</package>
12 changes: 10 additions & 2 deletions NuGet/WampSharp.Vtortola.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
<authors>CodeSharp</authors>
<owners />
<dependencies>
<dependency id="WampSharp" version="[$version$]" />
<dependency id="vtortola.WebSocketListener" version="[2.2.2]" />
<group targetFramework="net45">
<dependency id="WampSharp" version="[$version$]" />
<dependency id="vtortola.WebSocketListener" version="[2.2.2]" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="WampSharp" version="[$version$]" />
<dependency id="vtortola.WebSocketListener" version="[3.0.0-beta]" />
</group>
</dependencies>
<id>WampSharp.Vtortola</id>
<title>WampSharp Vtortola support</title>
Expand All @@ -18,5 +24,7 @@
<files>
<file src="$bin$\net45\WampSharp.Vtortola.dll" target="lib\net45\WampSharp.Vtortola.dll" />
<file src="$bin$\net45\WampSharp.Vtortola.xml" target="lib\net45\WampSharp.Vtortola.xml" />
<file src="$bin$\netstandard2.0\WampSharp.Vtortola.dll" target="lib\netstandard2.0\WampSharp.Vtortola.dll" />
<file src="$bin$\netstandard2.0\WampSharp.Vtortola.xml" target="lib\netstandard2.0\WampSharp.Vtortola.xml" />
</files>
</package>
6 changes: 6 additions & 0 deletions NuGet/WampSharp.WebSocket4Net.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<dependency id="WampSharp" version="[$version$]" />
<dependency id="WebSocket4Net" version="[0.15.0-beta9, )" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="WampSharp" version="[$version$]" />
<dependency id="WebSocket4Net" version="[0.15.0-beta9, )" />
</group>
</dependencies>
<id>WampSharp.WebSocket4Net</id>
<title>WampSharp WebSocket4Net connection</title>
Expand All @@ -32,5 +36,7 @@
<file src="$bin$\net40\WampSharp.WebSocket4Net.xml" target="lib\net40\WampSharp.WebSocket4Net.xml" />
<file src="$bin$\netstandard1.3\WampSharp.WebSocket4Net.dll" target="lib\netstandard1.3\WampSharp.WebSocket4Net.dll" />
<file src="$bin$\netstandard1.3\WampSharp.WebSocket4Net.xml" target="lib\netstandard1.3\WampSharp.WebSocket4Net.xml" />
<file src="$bin$\netstandard2.0\WampSharp.WebSocket4Net.dll" target="lib\netstandard2.0\WampSharp.WebSocket4Net.dll" />
<file src="$bin$\netstandard2.0\WampSharp.WebSocket4Net.xml" target="lib\netstandard2.0\WampSharp.WebSocket4Net.xml" />
</files>
</package>
7 changes: 6 additions & 1 deletion NuGet/WampSharp.WebSockets.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
<description>WampSharp System.Net.WebSockets.WebSocket support</description>
<tags>websockets,wampws,rpc,pubsub,wampv1,wampv2</tags>
<dependencies>
<group targetFramework="net45">
<dependency id="WampSharp" version="[$version$]" />
</group>
<group targetFramework=".NETStandard1.3">
<dependency id="System.Net.WebSockets.Client" version="[4.3.1, )" />
<dependency id="WampSharp" version="[$version$]" />
</group>
<group targetFramework="net45">
<group targetFramework=".NETStandard2.0">
<dependency id="WampSharp" version="[$version$]" />
</group>
</dependencies>
Expand All @@ -24,5 +27,7 @@
<file src="$bin$\net45\WampSharp.WebSockets.xml" target="lib\net45\WampSharp.WebSockets.xml" />
<file src="$bin$\netstandard1.3\WampSharp.WebSockets.dll" target="lib\netstandard1.3\WampSharp.WebSockets.dll" />
<file src="$bin$\netstandard1.3\WampSharp.WebSockets.xml" target="lib\netstandard1.3\WampSharp.WebSockets.xml" />
<file src="$bin$\netstandard2.0\WampSharp.WebSockets.dll" target="lib\netstandard2.0\WampSharp.WebSockets.dll" />
<file src="$bin$\netstandard2.0\WampSharp.WebSockets.xml" target="lib\netstandard2.0\WampSharp.WebSockets.xml" />
</files>
</package>
30 changes: 16 additions & 14 deletions NuGet/WampSharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<owners />
<dependencies>
<group targetFramework="net45">
<dependency id="System.Reactive" version="[3.0.0, )" />
<dependency id="System.Reactive" version="[3.0.0, 4)" />
<dependency id="System.Collections.Immutable" version="[1.3.1, )" />
<dependency id="System.Threading.Tasks.Dataflow" version="[4.7.0, )" />
<dependency id="Castle.Core" version="[4.1.1, )" />
Expand All @@ -19,35 +19,35 @@
<dependency id="Rackspace.Collections.Immutable" version="[1.1.36]" />
</group>
<group targetFramework="portable-win81+wpa81">
<dependency id="System.Reactive" version="[3.0.0, )" />
<dependency id="System.Reactive" version="[3.0.0, 4)" />
<dependency id="System.Collections.Immutable" version="[1.3.1, )" />
<dependency id="System.Threading.Tasks.Dataflow" version="[4.7.0, )" />
<dependency id="System.ValueTuple" version="[4.4.0, )" />
</group>
<group targetFramework=".NETStandard1.3">
<dependency id="Microsoft.CSharp" version="[4.3.0, )" />
<dependency id="Castle.Core" version="[4.1.1, )" />
<dependency id="System.Collections.Concurrent" version="[4.3.0, )" />
<dependency id="System.Collections.Immutable" version="[1.3.1, )" />
<dependency id="System.ComponentModel" version="[4.3.0, )" />
<dependency id="System.Net.Primitives" version="[4.3.0, )" />
<dependency id="System.Reactive" version="[3.1.1, )" />
<dependency id="System.Reflection.Extensions" version="[4.3.0, )" />
<dependency id="System.Reflection.TypeExtensions" version="[4.3.0, )" />
<dependency id="System.Runtime" version="[4.3.0, )" />
<dependency id="System.Reactive" version="[3.0.0, 4)" />
<dependency id="System.Runtime.Serialization.Primitives" version="[4.3.0, )" />
<dependency id="System.Security.Cryptography.Algorithms" version="[4.3.0, )" />
<dependency id="System.Text.RegularExpressions" version="[4.3.0, )" />
<dependency id="System.Threading.Tasks.Dataflow" version="[4.7.0, )" />
<dependency id="System.ValueTuple" version="[4.4.0, )" />
<dependency id="NETStandard.Library" version="[1.6.1, )" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.CSharp" version="[4.3.0, )" />
<dependency id="Castle.Core" version="[4.1.1, )" />
<dependency id="System.Collections.Immutable" version="[1.3.1, )" />
<dependency id="System.Reactive" version="[3.0.0, 4)" />
<dependency id="System.Threading.Tasks.Dataflow" version="[4.7.0, )" />
<dependency id="System.ValueTuple" version="[4.4.0, )" />
</group>
<group targetFramework="UAP10.0">
<dependency id="Microsoft.NETCore.UniversalWindowsPlatform" version="[5.2.2 , )" />
<dependency id="System.Reactive" version="[3.0.0, )" />
<dependency id="System.Reactive" version="[3.0.0, 4)" />
<dependency id="System.ValueTuple" version="[4.4.0, )" />
</group>
<group targetFramework="Xamarin.iOS10">
<dependency id="System.Reactive" version="[3.0.0, )" />
<dependency id="System.Reactive" version="[3.0.0, 4)" />
<dependency id="System.Collections.Immutable" version="[1.3.1, )" />
<dependency id="System.Threading.Tasks.Dataflow" version="[4.7.0, )" />
<dependency id="System.ValueTuple" version="[4.4.0, )" />
Expand All @@ -71,6 +71,8 @@
<file src="$bin$\pcl\WampSharp.xml" target="lib\Xamarin.iOS10\WampSharp.xml" />
<file src="$bin$\netstandard1.3\WampSharp.dll" target="lib\netstandard1.3\WampSharp.dll" />
<file src="$bin$\netstandard1.3\WampSharp.xml" target="lib\netstandard1.3\WampSharp.xml" />
<file src="$bin$\netstandard2.0\WampSharp.dll" target="lib\netstandard2.0\WampSharp.dll" />
<file src="$bin$\netstandard2.0\WampSharp.xml" target="lib\netstandard2.0\WampSharp.xml" />
<file src="$bin$\uap10.0\WampSharp.dll" target="lib\uap10.0\WampSharp.dll" />
<file src="$bin$\uap10.0\WampSharp.xml" target="lib\uap10.0\WampSharp.xml" />
</files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using SuperSocket.ClientEngine;
using WampSharp.Core.Listener;
using WampSharp.Core.Message;
using WampSharp.Logging;
using WampSharp.V2.Binding;
using WebSocket4Net;

Expand All @@ -14,14 +15,17 @@ public abstract class WebSocket4NetConnection<TMessage> : IControlledWampConnect
private readonly IWampBinding<TMessage> mBinding;

private readonly WebSocket mWebSocket;


private readonly ILog mLogger;

#endregion

public WebSocket4NetConnection(WebSocket webSocket,
IWampBinding<TMessage> binding)
{
mBinding = binding;
mWebSocket = webSocket;
mLogger = LogProvider.GetLogger(this.GetType());
mWebSocket.Opened += WebSocketOnOpened;
mWebSocket.Closed += WebSocketOnClosed;
mWebSocket.Error += WebSocketOnError;
Expand Down Expand Up @@ -73,6 +77,7 @@ private void WebSocketOnClosed(object sender, EventArgs eventArgs)

private void WebSocketOnError(object sender, ErrorEventArgs e)
{
mLogger.Error("A connection error occured", e.Exception);
RaiseConnectionError(e.Exception);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using vtortola.WebSockets;
using WampSharp.Core.Message;
Expand All @@ -12,9 +13,10 @@ internal class VtortolaWampBinaryConnection<TMessage> : VtortolaWampConnection<T
private readonly IWampBinaryBinding<TMessage> mBinding;

public VtortolaWampBinaryConnection(WebSocket connection,
IWampBinaryBinding<TMessage> binding,
ICookieAuthenticatorFactory cookieAuthenticatorFactory) :
base(connection, cookieAuthenticatorFactory)
CancellationToken cancellationToken,
IWampBinaryBinding<TMessage> binding,
ICookieAuthenticatorFactory cookieAuthenticatorFactory) :
base(connection, cancellationToken, cookieAuthenticatorFactory)
{
mBinding = binding;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ internal abstract class VtortolaWampConnection<TMessage> : AsyncWebSocketWampCon
IDetailedWampConnection<TMessage>
{
protected readonly WebSocket mWebsocket;
private readonly CancellationToken mCancellationToken;
private readonly VtortolaTransportDetails mTransportDetails;

protected VtortolaWampConnection(WebSocket websocket,
ICookieAuthenticatorFactory cookieAuthenticatorFactory)
CancellationToken cancellationToken,
ICookieAuthenticatorFactory cookieAuthenticatorFactory)
: base(new CookieCollectionCookieProvider(websocket.HttpRequest.Cookies),
cookieAuthenticatorFactory)
cookieAuthenticatorFactory)
{
mWebsocket = websocket;
mCancellationToken = cancellationToken;
mTransportDetails = new VtortolaTransportDetails(mWebsocket);
}

Expand All @@ -33,7 +36,7 @@ public async Task HandleWebSocketAsync()
{
RaiseConnectionOpen();

while (mWebsocket.IsConnected)
while (IsConnected)
{
WebSocketMessageReadStream message =
await mWebsocket.ReadMessageAsync(CancellationToken.None)
Expand Down Expand Up @@ -63,7 +66,8 @@ protected override bool IsConnected
{
get
{
return mWebsocket.IsConnected;
return !mCancellationToken.IsCancellationRequested &&
mWebsocket.IsConnected;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using vtortola.WebSockets;
using WampSharp.Core.Message;
Expand All @@ -12,9 +13,10 @@ internal class VtortolaWampTextConnection<TMessage> : VtortolaWampConnection<TMe
private readonly IWampTextBinding<TMessage> mBinding;

public VtortolaWampTextConnection(WebSocket connection,
IWampTextBinding<TMessage> binding,
ICookieAuthenticatorFactory cookieAuthenticatorFactory) :
base(connection, cookieAuthenticatorFactory)
CancellationToken cancellationToken,
IWampTextBinding<TMessage> binding,
ICookieAuthenticatorFactory cookieAuthenticatorFactory) :
base(connection, cancellationToken, cookieAuthenticatorFactory)
{
mBinding = binding;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System.Linq;
using System.Net;
using vtortola.WebSockets;
#if NETCORE
using HttpStatusCode = vtortola.WebSockets.HttpStatusCode;
#endif

namespace WampSharp.Vtortola
{
Expand Down
Loading

0 comments on commit f7f71bb

Please sign in to comment.