34 lines
962 B
C#
34 lines
962 B
C#
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; }
|
|
} |