diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..72043f7
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+# Editor configuration, see http://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 3
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+max_line_length = 100
diff --git a/.gitignore b/.gitignore
index 4ce6fdd..faab6aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -337,4 +337,7 @@ ASALocalRun/
.localhistory/
# BeatPulse healthcheck temp database
-healthchecksdb
\ No newline at end of file
+healthchecksdb
+
+
+nuget.config
\ No newline at end of file
diff --git a/Senstate-ExampleApp/Program.cs b/Senstate-ExampleApp/Program.cs
index 8b9afa9..58f42b4 100644
--- a/Senstate-ExampleApp/Program.cs
+++ b/Senstate-ExampleApp/Program.cs
@@ -1,134 +1,83 @@
-using Newtonsoft.Json;
using Senstate.CSharp_Client;
-using Senstate.CSharp_Client.Tests;
+using Senstate.NetStandard;
using System;
-using System.Linq;
-using System.Net.WebSockets;
-using System.Text;
using System.Threading;
-using System.Threading.Tasks;
namespace Senstate_ExampleApp
{
- class Program
- {
- static void Main(string[] args)
- {
- SenstateContext.AppName = "C# Console Log";
- SenstateContext.SerializerInstance = new DummySerializer();
- SenstateContext.WebSocketInstance = new DotNetWebSocket();
- SenstateContext.RegisterApp();
-
- var stringWatcher = new Watcher(
- new WatcherMeta
- {
- Tag = "Some Label",
- Type = WatcherType.String,
- Group = "Example Group 1"
- }
- );
-
- var numberWatcher = new Watcher(
- new WatcherMeta
- {
- Tag = "Number",
- Type = WatcherType.Number,
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var webSocket = new NetStandardWebSocketImplementation();
+ webSocket.ExceptionThrown += (sender, e) =>
+ {
+ throw e.Exception;
+ };
+
+ SenstateContext.SerializerInstance = new NetStandardJsonNetImplementation();
+ SenstateContext.WebSocketInstance = webSocket;
+ SenstateContext.RegisterApp("C# Console Log");
+
+ var stringWatcher = new Watcher(
+ new WatcherMeta
+ {
+ Tag = "Some Label",
+ Type = WatcherType.String,
Group = "Example Group 1"
- }
- );
-
- var objectWatcher = new Watcher(
- new WatcherMeta
- {
- Tag = "Object",
- Type = WatcherType.Json,
- Group = "Special"
- }
- );
-
- try
- {
- throw new NullReferenceException();
- }
- catch(Exception ex)
- {
- ErrorSender.Send(ex);
- }
-
- for (var i = 0; i<10000; i++) {
-
- Thread.Sleep(500);
+ }
+ );
+
+ var numberWatcher = new Watcher(
+ new WatcherMeta
+ {
+ Tag = "Number",
+ Type = WatcherType.Number,
+ Group = "Example Group 1"
+ }
+ );
+
+ var objectWatcher = new Watcher(
+ new WatcherMeta
+ {
+ Tag = "Object",
+ Type = WatcherType.Json,
+ Group = "Special"
+ }
+ );
+
+ try
+ {
+ throw new NullReferenceException();
+ }
+ catch (Exception ex)
+ {
+ ErrorSender.Send(ex);
+ }
+
+ for (var i = 0; i < 10000; i++)
+ {
+
+ Thread.Sleep(500);
stringWatcher.SendData($"This an example Text {i}");
- numberWatcher.SendData(i);
-
- var someObject = new
- {
- example = true,
- sub = new
- {
- data = i
- }
- };
-
- Logger.SendLog(LoggerType.Debug, $"Debug {i}", someObject);
- Logger.SendLog(LoggerType.Info, $"Info {i}");
-
-
- objectWatcher.SendData(someObject);
- }
-
-
- Console.ReadKey();
- }
+ numberWatcher.SendData(i);
-
-
- private class DummyWebSocket : ISenstateWebSocket
- {
- public void CreateSocket(Uri targetEndpoint)
- {
- Console.WriteLine("Created a Dummy Socket");
- }
-
- public void SendToSocket(string jsonData)
- {
- Console.WriteLine($"{jsonData}");
- }
- }
-
-
- private class DotNetWebSocket : ISenstateWebSocket
- {
- ClientWebSocket m_socket = new ClientWebSocket();
- private Task connectionTask = null;
-
- public void CreateSocket(Uri targetEndpoint)
+ var someObject = new
{
- CancellationTokenSource source = new CancellationTokenSource();
- CancellationToken token = source.Token;
-
- connectionTask = m_socket.ConnectAsync(targetEndpoint, token);
- }
-
- public async void SendToSocket(string jsonData)
- {
- if (!connectionTask.IsCompleted)
- {
- await connectionTask;
- }
-
- if (m_socket.State == WebSocketState.Open)
- {
- CancellationTokenSource source = new CancellationTokenSource();
- CancellationToken token = source.Token;
-
- var utf8Array = Encoding.UTF8.GetBytes(jsonData).AsMemory();
-
-
- Console.WriteLine($"Sending to Hub {jsonData}");
- await m_socket.SendAsync(utf8Array, WebSocketMessageType.Text, true, token);
- }
- }
- }
- }
+ example = true,
+ sub = new
+ {
+ data = i
+ }
+ };
+
+ Logger.SendLog(LoggerType.Debug, $"Debug {i}", someObject);
+ Logger.SendLog(LoggerType.Info, $"Info {i}");
+
+ objectWatcher.SendData(someObject);
+ }
+
+ Console.ReadKey();
+ }
+ }
}
diff --git a/Senstate-ExampleApp/Senstate-ExampleApp.csproj b/Senstate-ExampleApp/Senstate-ExampleApp.csproj
index b7d4050..c538fd1 100644
--- a/Senstate-ExampleApp/Senstate-ExampleApp.csproj
+++ b/Senstate-ExampleApp/Senstate-ExampleApp.csproj
@@ -13,6 +13,7 @@
+
diff --git a/Senstate.CSharp-Client.Tests/DummySerializer.cs b/Senstate.CSharp-Client.Tests/DummySerializer.cs
deleted file mode 100644
index ce1730c..0000000
--- a/Senstate.CSharp-Client.Tests/DummySerializer.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Newtonsoft.Json;
-
-namespace Senstate.CSharp_Client.Tests
-{
- public class DummySerializer : ISenstateJson
- {
- public string ConvertToString(object data)
- {
- return JsonConvert.SerializeObject(data, new JsonSerializerSettings
- {
- NullValueHandling = NullValueHandling.Ignore
- });
- }
- }
-}
diff --git a/Senstate.CSharp-Client.Tests/Senstate.CSharp-Client.Tests.csproj b/Senstate.CSharp-Client.Tests/Senstate.CSharp-Client.Tests.csproj
index 8ad2da5..1e19ca6 100644
--- a/Senstate.CSharp-Client.Tests/Senstate.CSharp-Client.Tests.csproj
+++ b/Senstate.CSharp-Client.Tests/Senstate.CSharp-Client.Tests.csproj
@@ -17,6 +17,7 @@
+
diff --git a/Senstate.CSharp-Client.Tests/TestContext.cs b/Senstate.CSharp-Client.Tests/TestContext.cs
index f4d6b2e..dd1bc8e 100644
--- a/Senstate.CSharp-Client.Tests/TestContext.cs
+++ b/Senstate.CSharp-Client.Tests/TestContext.cs
@@ -1,4 +1,5 @@
-using Moq;
+using Moq;
+using Senstate.NetStandard;
namespace Senstate.CSharp_Client.Tests
{
@@ -9,12 +10,11 @@ public static Mock RegisterApp ()
var webSocketMock = new Mock();
SenstateContext.AppId = "1234";
- SenstateContext.AppName = "Some Name";
- SenstateContext.SerializerInstance = new DummySerializer();
+ SenstateContext.SerializerInstance = new NetStandardJsonNetImplementation();
SenstateContext.WebSocketInstance = webSocketMock.Object;
- SenstateContext.RegisterApp();
+ SenstateContext.RegisterApp("Some Name");
return webSocketMock;
}
diff --git a/Senstate.CSharp-Client.sln b/Senstate.CSharp-Client.sln
index 2830215..d6de86c 100644
--- a/Senstate.CSharp-Client.sln
+++ b/Senstate.CSharp-Client.sln
@@ -5,13 +5,21 @@ VisualStudioVersion = 16.0.30002.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senstate.CSharp-Client", "Senstate.CSharp-Client\Senstate.CSharp-Client.csproj", "{180EF5BB-810E-413F-9F17-AD8E3A118F8C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Senstate.Json", "Senstate.Json\Senstate.Json.csproj", "{4F8A6955-1D3E-4F60-964C-DC9DCB80DC46}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senstate-ExampleApp", "Senstate-ExampleApp\Senstate-ExampleApp.csproj", "{5A78AEE3-3206-48DB-A09D-502CCA887BCD}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Senstate.WebSocket", "Senstate.WebSocket\Senstate.WebSocket.csproj", "{759953ED-6402-4E19-B15F-8F4FAAA702F0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senstate.CSharp-Client.Tests", "Senstate.CSharp-Client.Tests\Senstate.CSharp-Client.Tests.csproj", "{0C835DA8-5521-4D16-8F5C-00EF94DFFE82}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Senstate-ExampleApp", "Senstate-ExampleApp\Senstate-ExampleApp.csproj", "{5A78AEE3-3206-48DB-A09D-502CCA887BCD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorAppServerSide", "BlazorAppServerSide\BlazorAppServerSide.csproj", "{19C726F7-9950-4809-9635-5E242BC6541D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Senstate.CSharp-Client.Tests", "Senstate.CSharp-Client.Tests\Senstate.CSharp-Client.Tests.csproj", "{0C835DA8-5521-4D16-8F5C-00EF94DFFE82}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWASM", "BlazorWASM\BlazorWASM.csproj", "{391B0753-FC37-4683-A4B9-39CC931B8F7E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Senstate.NetStandard", "Senstate.NetStandard\Senstate.NetStandard.csproj", "{743F3C4A-7FFA-476F-8223-9F8E89ED518F}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5955506B-E0CD-4F4D-A174-37B27018DC83}"
+ ProjectSection(SolutionItems) = preProject
+ .editorconfig = .editorconfig
+ build.bat = build.bat
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -23,14 +31,6 @@ Global
{180EF5BB-810E-413F-9F17-AD8E3A118F8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{180EF5BB-810E-413F-9F17-AD8E3A118F8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{180EF5BB-810E-413F-9F17-AD8E3A118F8C}.Release|Any CPU.Build.0 = Release|Any CPU
- {4F8A6955-1D3E-4F60-964C-DC9DCB80DC46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4F8A6955-1D3E-4F60-964C-DC9DCB80DC46}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4F8A6955-1D3E-4F60-964C-DC9DCB80DC46}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4F8A6955-1D3E-4F60-964C-DC9DCB80DC46}.Release|Any CPU.Build.0 = Release|Any CPU
- {759953ED-6402-4E19-B15F-8F4FAAA702F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {759953ED-6402-4E19-B15F-8F4FAAA702F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {759953ED-6402-4E19-B15F-8F4FAAA702F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {759953ED-6402-4E19-B15F-8F4FAAA702F0}.Release|Any CPU.Build.0 = Release|Any CPU
{5A78AEE3-3206-48DB-A09D-502CCA887BCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A78AEE3-3206-48DB-A09D-502CCA887BCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A78AEE3-3206-48DB-A09D-502CCA887BCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -39,6 +39,18 @@ Global
{0C835DA8-5521-4D16-8F5C-00EF94DFFE82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C835DA8-5521-4D16-8F5C-00EF94DFFE82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C835DA8-5521-4D16-8F5C-00EF94DFFE82}.Release|Any CPU.Build.0 = Release|Any CPU
+ {19C726F7-9950-4809-9635-5E242BC6541D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {19C726F7-9950-4809-9635-5E242BC6541D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {19C726F7-9950-4809-9635-5E242BC6541D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {19C726F7-9950-4809-9635-5E242BC6541D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {391B0753-FC37-4683-A4B9-39CC931B8F7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {391B0753-FC37-4683-A4B9-39CC931B8F7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {391B0753-FC37-4683-A4B9-39CC931B8F7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {391B0753-FC37-4683-A4B9-39CC931B8F7E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {743F3C4A-7FFA-476F-8223-9F8E89ED518F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {743F3C4A-7FFA-476F-8223-9F8E89ED518F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {743F3C4A-7FFA-476F-8223-9F8E89ED518F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {743F3C4A-7FFA-476F-8223-9F8E89ED518F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Senstate.CSharp-Client/Interfaces.cs b/Senstate.CSharp-Client/Interfaces.cs
new file mode 100644
index 0000000..44c8932
--- /dev/null
+++ b/Senstate.CSharp-Client/Interfaces.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace Senstate.CSharp_Client
+{
+ public interface ISenstateJson
+ {
+ string ConvertToString(object data);
+ }
+
+ public interface ISenstateWebSocket
+ {
+ void CreateSocket(Uri targetEndpoint);
+ void SendToSocket(string jsonData);
+ }
+}
diff --git a/Senstate.CSharp-Client/Logger.cs b/Senstate.CSharp-Client/Logger.cs
index 8ef587a..8aafce5 100644
--- a/Senstate.CSharp-Client/Logger.cs
+++ b/Senstate.CSharp-Client/Logger.cs
@@ -1,4 +1,4 @@
-namespace Senstate.CSharp_Client
+namespace Senstate.CSharp_Client
{
public enum LoggerType
{
@@ -26,5 +26,4 @@ public static void SendLog(LoggerType logLevel, string log, object data = null)
});
}
}
-
}
diff --git a/Senstate.CSharp-Client/Senstate.CSharp-Client.csproj b/Senstate.CSharp-Client/Senstate.CSharp-Client.csproj
index 56ed540..4877134 100644
--- a/Senstate.CSharp-Client/Senstate.CSharp-Client.csproj
+++ b/Senstate.CSharp-Client/Senstate.CSharp-Client.csproj
@@ -3,6 +3,8 @@
netstandard2.0
Senstate.CSharp_Client
+ 0.1.0
+
diff --git a/Senstate.CSharp-Client/SenstateContext.cs b/Senstate.CSharp-Client/SenstateContext.cs
index 9eb25a1..88ec575 100644
--- a/Senstate.CSharp-Client/SenstateContext.cs
+++ b/Senstate.CSharp-Client/SenstateContext.cs
@@ -1,71 +1,52 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Text;
namespace Senstate.CSharp_Client
{
- public static class SenstateEventConstants
- {
- public static string AddApp {get;set;} = "addApp";
- public static string AddWatcher {get;set;} = "addWatcher";
- public static string InputEvent {get;set;} = "inputEvent";
- public static string LogEvent {get;set;} = "inputLogEvent";
- public static string ErrorEvent {get;set;} = "inputErrorEvent";
- }
-
- public static class SenstateContext
- {
- public static string AppName { get; set; }
- public static string AppId { get; set; } = Guid.NewGuid().ToString();
-
-
- public static ISenstateJson SerializerInstance { get; set; }
- public static ISenstateWebSocket WebSocketInstance { get; set; }
-
- public static void RegisterApp(Uri targetEndpoint = null)
- {
- if (targetEndpoint == null)
- {
- targetEndpoint = new Uri("ws://localhost:3333");
- }
-
- WebSocketInstance.CreateSocket(targetEndpoint);
-
- SendEventData(SenstateEventConstants.AddApp, new
- {
- appId = AppId,
- name = AppName
- });
- }
-
- public static void SendEventData(string eventType, object eventData)
- {
- var eventToSend = CreateEventJson(eventType, eventData);
-
- WebSocketInstance.SendToSocket(eventToSend);
- }
-
- public static string CreateEventJson(string eventType, object eventData)
- {
- var objectToSend = new Dictionary
- {
- {"event", eventType },
- {"data", eventData}
- };
-
- return SerializerInstance.ConvertToString(objectToSend);
- }
- }
-
- public interface ISenstateJson
- {
- string ConvertToString(object data);
- }
-
- public interface ISenstateWebSocket
- {
- void CreateSocket(Uri targetEndpoint);
- void SendToSocket(string jsonData);
- }
+ public static class SenstateContext
+ {
+ public static string AppName { get; set; }
+ public static string AppId { get; set; } = Guid.NewGuid().ToString();
+
+
+ public static ISenstateJson SerializerInstance { get; set; }
+ public static ISenstateWebSocket WebSocketInstance { get; set; }
+
+ public static void RegisterApp(string appName = null, Uri targetEndpoint = null)
+ {
+ AppName = appName;
+ if (targetEndpoint == null)
+ {
+ targetEndpoint = new Uri("ws://localhost:3333");
+ }
+
+ WebSocketInstance.CreateSocket(targetEndpoint);
+
+ SendEventData(SenstateEventConstants.AddApp, new
+ {
+ appId = AppId,
+ name = AppName
+ });
+ }
+
+ public static void SendEventData(string eventType, object eventData)
+ {
+ var eventToSend = CreateEventJson(eventType, eventData);
+
+ WebSocketInstance.SendToSocket(eventToSend);
+ }
+
+ public static string CreateEventJson(string eventType, object eventData)
+ {
+ var objectToSend = new Dictionary
+ {
+ {"event", eventType },
+ {"data", eventData}
+ };
+
+ return SerializerInstance.ConvertToString(objectToSend);
+ }
+ }
}
diff --git a/Senstate.CSharp-Client/SenstateEventConstants.cs b/Senstate.CSharp-Client/SenstateEventConstants.cs
new file mode 100644
index 0000000..005dc6f
--- /dev/null
+++ b/Senstate.CSharp-Client/SenstateEventConstants.cs
@@ -0,0 +1,11 @@
+namespace Senstate.CSharp_Client
+{
+ public static class SenstateEventConstants
+ {
+ public static string AddApp { get; set; } = "addApp";
+ public static string AddWatcher { get; set; } = "addWatcher";
+ public static string InputEvent { get; set; } = "inputEvent";
+ public static string LogEvent { get; set; } = "inputLogEvent";
+ public static string ErrorEvent { get; set; } = "inputErrorEvent";
+ }
+}
diff --git a/Senstate.Json/Class1.cs b/Senstate.Json/Class1.cs
deleted file mode 100644
index b13ed4c..0000000
--- a/Senstate.Json/Class1.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-
-namespace Senstate.Json
-{
- public class Class1
- {
- }
-}
diff --git a/Senstate.Json/Senstate.Json.csproj b/Senstate.Json/Senstate.Json.csproj
deleted file mode 100644
index 9f5c4f4..0000000
--- a/Senstate.Json/Senstate.Json.csproj
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- netstandard2.0
-
-
-
diff --git a/Senstate.NetStandard/NetStandardJsonNetImplementation.cs b/Senstate.NetStandard/NetStandardJsonNetImplementation.cs
new file mode 100644
index 0000000..5603bca
--- /dev/null
+++ b/Senstate.NetStandard/NetStandardJsonNetImplementation.cs
@@ -0,0 +1,16 @@
+using Newtonsoft.Json;
+using Senstate.CSharp_Client;
+
+namespace Senstate.NetStandard
+{
+ public class NetStandardJsonNetImplementation : ISenstateJson
+ {
+ public string ConvertToString(object data)
+ {
+ return JsonConvert.SerializeObject(data, new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore
+ });
+ }
+ }
+}
diff --git a/Senstate.NetStandard/NetStandardWebSocketImplementation.cs b/Senstate.NetStandard/NetStandardWebSocketImplementation.cs
new file mode 100644
index 0000000..b15cb02
--- /dev/null
+++ b/Senstate.NetStandard/NetStandardWebSocketImplementation.cs
@@ -0,0 +1,65 @@
+using Senstate.CSharp_Client;
+using System;
+using System.Net.WebSockets;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Senstate.NetStandard
+{
+ public class NetStandardWebSocketImplementation : ISenstateWebSocket
+ {
+ public event EventHandler ExceptionThrown;
+
+ ClientWebSocket m_socket = new ClientWebSocket();
+ private Task connectionTask = null;
+
+ public NetStandardWebSocketImplementation()
+ {
+ }
+
+ public void CreateSocket(Uri targetEndpoint)
+ {
+ CancellationTokenSource source = new CancellationTokenSource();
+ CancellationToken token = source.Token;
+
+ connectionTask = m_socket.ConnectAsync(targetEndpoint, token);
+ }
+
+ public async void SendToSocket(string jsonData)
+ {
+ try
+ {
+ if (!connectionTask.IsCompleted)
+ {
+ await connectionTask;
+ }
+
+ if (m_socket.State == WebSocketState.Open)
+ {
+ CancellationTokenSource source = new CancellationTokenSource();
+ CancellationToken token = source.Token;
+
+ var utf8Array = new ArraySegment(Encoding.UTF8.GetBytes(jsonData));
+
+ await m_socket.SendAsync(utf8Array, WebSocketMessageType.Text, true, token);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ExceptionThrown != null)
+ {
+ ExceptionThrown.Invoke(this, new ExceptionEventArgs
+ {
+ Exception = ex
+ });
+ }
+ }
+ }
+ }
+
+ public class ExceptionEventArgs : EventArgs
+ {
+ public Exception Exception { get; set; }
+ }
+}
diff --git a/Senstate.NetStandard/Senstate.NetStandard.csproj b/Senstate.NetStandard/Senstate.NetStandard.csproj
new file mode 100644
index 0000000..581ec47
--- /dev/null
+++ b/Senstate.NetStandard/Senstate.NetStandard.csproj
@@ -0,0 +1,16 @@
+
+
+
+ netstandard2.0
+ 0.1.0
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Senstate.WebSocket/Class1.cs b/Senstate.WebSocket/Class1.cs
deleted file mode 100644
index 207f95b..0000000
--- a/Senstate.WebSocket/Class1.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-
-namespace Senstate.WebSocket
-{
- public class Class1
- {
- }
-}
diff --git a/Senstate.WebSocket/Senstate.WebSocket.csproj b/Senstate.WebSocket/Senstate.WebSocket.csproj
deleted file mode 100644
index 9f5c4f4..0000000
--- a/Senstate.WebSocket/Senstate.WebSocket.csproj
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- netstandard2.0
-
-
-
diff --git a/build.bat b/build.bat
new file mode 100644
index 0000000..6f538df
--- /dev/null
+++ b/build.bat
@@ -0,0 +1,2 @@
+dotnet pack Senstate.CSharp-Client --configuration Release
+dotnet pack Senstate.NetStandard --configuration Release