mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
25 lines
752 B
C#
25 lines
752 B
C#
using System.Net.WebSockets;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace BTCPayServer
|
|
{
|
|
public class HwiWebSocketTransport : Hwi.Transports.ITransport
|
|
{
|
|
private readonly WebSocketHelper _webSocket;
|
|
|
|
public HwiWebSocketTransport(WebSocket webSocket)
|
|
{
|
|
_webSocket = new WebSocketHelper(webSocket);
|
|
}
|
|
public async Task<string> SendCommandAsync(string[] arguments, CancellationToken cancel)
|
|
{
|
|
JObject request = new JObject();
|
|
request.Add("params", new JArray(arguments));
|
|
await _webSocket.Send(request.ToString(), cancel);
|
|
return await _webSocket.NextMessageAsync(cancel);
|
|
}
|
|
}
|
|
}
|