Skip to content

Commit 8cc22fa

Browse files
authored
Merge pull request #178 from coinapi/SDKConsoleApp
utf8json -> system.text.json, update tests project to .net8
2 parents b0bdc6b + 4c0f37b commit 8cc22fa

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

data-api/csharp-ws/CoinAPI.WebSocket.V1.Tests/CoinAPI.WebSocket.V1.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

data-api/csharp-ws/CoinAPI.WebSocket.V1/CoinAPI.WebSocket.V1.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
<ItemGroup>
2323
<PackageReference Include="Microsoft.CSharp" Version="4.6.0" />
24+
<PackageReference Include="System.Text.Json" Version="8.0.3" />
2425
<PackageReference Include="Utf8Json" Version="1.3.7" />
2526
</ItemGroup>
2627

data-api/csharp-ws/CoinAPI.WebSocket.V1/CoinApiWsClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Threading;
66
using System.Threading.Tasks;
77
using CoinAPI.WebSocket.V1.DataModels;
8-
using Utf8Json;
8+
using System.Text.Json;
99

1010
namespace CoinAPI.WebSocket.V1
1111
{
@@ -309,7 +309,7 @@ private async Task HandleConnection(CancellationTokenSource connectionCts)
309309
Interlocked.Exchange(ref _hbLastAction, 0);
310310

311311
var currentHello = HelloMessage;
312-
var helloAs = new ArraySegment<byte>(JsonSerializer.Serialize(currentHello));
312+
var helloAs = new ArraySegment<byte>(JsonSerializer.SerializeToUtf8Bytes(currentHello));
313313
await _client.SendAsync(helloAs, WebSocketMessageType.Text, true, connectionCts.Token);
314314
Interlocked.Exchange(ref _hbLastAction, 0);
315315

@@ -319,7 +319,7 @@ private async Task HandleConnection(CancellationTokenSource connectionCts)
319319
if (currentHello != HelloMessage)
320320
{
321321
currentHello = HelloMessage;
322-
helloAs = new ArraySegment<byte>(JsonSerializer.Serialize(currentHello));
322+
helloAs = new ArraySegment<byte>(JsonSerializer.SerializeToUtf8Bytes(currentHello));
323323
await _client.SendAsync(helloAs, WebSocketMessageType.Text, true, connectionCts.Token);
324324
Interlocked.Exchange(ref _hbLastAction, 0);
325325
}

0 commit comments

Comments
 (0)