some tests
This commit is contained in:
44
stream_deck_plugin/ClientTest/Client.cs
Normal file
44
stream_deck_plugin/ClientTest/Client.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using SocketIOClient;
|
||||
|
||||
namespace ClientTest
|
||||
{
|
||||
public class Client
|
||||
{
|
||||
private SocketIO client;
|
||||
public Client()
|
||||
{
|
||||
client = new SocketIO(new Uri("http://localhost:5010/"));
|
||||
client.Options.AutoUpgrade = false;
|
||||
client.Options.ConnectionTimeout = TimeSpan.FromSeconds(10);
|
||||
client.Options.Reconnection = false;
|
||||
client.On("test_event", ctx =>
|
||||
{
|
||||
Console.WriteLine($"Received test event: {ctx.RawText}");
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
||||
client.On("collection_updated", ctx =>
|
||||
{
|
||||
Console.WriteLine($"Received test event: {ctx.RawText}");
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
client.OnAny((string eventName, IEventContext ctx) =>
|
||||
{
|
||||
Console.WriteLine($"got event: {eventName} \n {ctx.RawText}");
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
||||
client.ConnectAsync().Wait();
|
||||
|
||||
|
||||
|
||||
client.EmitAsync("test_event", [""]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user