Add project files.
This commit is contained in:
34
TestClient/Program.cs
Normal file
34
TestClient/Program.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Microsoft.AspNetCore.SignalR.Client;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Websocket.Client;
|
||||
|
||||
|
||||
var builder = new HubConnectionBuilder()
|
||||
.WithUrl("https://api.gastrojames.ch/hubs/internal?access_token=https://api.gastrojames.ch/hubs/internal") // Replace with your SignalR hub URL
|
||||
.WithAutomaticReconnect()
|
||||
;
|
||||
;
|
||||
|
||||
var connection = builder.Build();
|
||||
|
||||
await connection.StartAsync();
|
||||
string groupName = "67e534f8e86e816689323023"; // Replace with your actual group name
|
||||
await connection.InvokeAsync("JoinGroup", groupName);
|
||||
|
||||
connection.On<PrintJob>("PrintJob", (args) =>
|
||||
{
|
||||
Console.WriteLine($"Received print job for working area: {JsonSerializer.Serialize(args)}");
|
||||
|
||||
});
|
||||
|
||||
Console.ReadLine();
|
||||
|
||||
public class PrintJob
|
||||
{
|
||||
[JsonPropertyName("workingAreaId")]
|
||||
public string WorkingAreaId { get; set; }
|
||||
[JsonPropertyName("content")]
|
||||
public string Content { get; set; }
|
||||
}
|
||||
16
TestClient/TestClient.csproj
Normal file
16
TestClient/TestClient.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="10.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.1" />
|
||||
<PackageReference Include="Websocket.Client" Version="5.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user