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; }
|
||||
}
|
||||
Reference in New Issue
Block a user