这是使用WampSharp的最新预发布版本的非常简单的代码:
var channelFactory = new DefaultWampChannelFactory();
var channel = channelFactory.CreateMsgpackChannel("wss://api.poloniex.com", "realm1");
await channel.Open();
var realmProxy = channel.RealmProxy;
Console.WriteLine("Connection established");
int received = 0;
IDisposable subscription = null;
subscription =
realmProxy.Services.GetSubject("ticker")
.Subscribe(x =>
{
Console.WriteLine("Got Event: " + x);
received++;
if (received > 5)
{
Console.WriteLine("Closing ..");
subscription.Dispose();
}
});
Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)
但是不起作用,订阅中的代码永远不会运行.也尝试过CreateJsonChannel,这也不起作用.
什么想法可能是错的?