1
我想使用C#服务器事件客户端,其余的提供客户端用于演示目的。但我不太清楚如何设置它们?这是C#服务器事件客户端的C#控制台客户端或Web应用程序?我假设我需要创建一个新项目并将客户代码放入?我找不到与此相关的任何教程。ServiceStack - 如何设置C#服务器事件客户端?
我迄今所做的:
using ServiceStack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SimByte.RV.VPS.ConsoleClient
{
class Program
{
static void Main(string[] args)
{
ServerEventConnect connectMsg = null;
var msgs = new List<ServerEventMessage>();
var commands = new List<ServerEventMessage>();
var errors = new List<Exception>();
var client = new ServerEventsClient(
"http://localhost:58158/api/event-stream", channels: "OfficialPricesPush")
{
OnConnect = e => connectMsg = e,
OnCommand = commands.Add,
OnMessage = msgs.Add,
OnException = errors.Add,
}.Start();
}
}
}
当然,不给我我需要什么。谢谢您的帮助。