Add project files.

This commit is contained in:
EugeneTes
2026-01-13 09:06:47 +01:00
parent dd935fe1fa
commit 7390693f50
187 changed files with 83457 additions and 0 deletions

36
SendPrintJob/Program.cs Normal file
View File

@@ -0,0 +1,36 @@
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.Logging;
using System.Reflection;
using System.Text.Json.Serialization;
var url = "wss://api.dev.gastrojames.ch/hubs/internal";
var accessToken = url; // or your actual token
var connection = new HubConnectionBuilder()
.WithUrl(url, options =>
{
options.AccessTokenProvider = () => Task.FromResult<string?>(accessToken);
options.SkipNegotiation = true;
options.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets;
})
.WithAutomaticReconnect()
.Build();
connection.On<PrintJob>("PrintJob", (args) =>
{
Console.WriteLine($"Received print job for working area: {args.WorkingAreaId}");
});
await connection.StartAsync();
Console.ReadLine();
public class PrintJob
{
[JsonPropertyName("workingAreaId")]
public string WorkingAreaId { get; set; }
[JsonPropertyName("content")]
public string Content { get; set; }
}

View File

@@ -0,0 +1,14 @@
<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.0" />
</ItemGroup>
</Project>