本文整理汇总了C#中Client.Hubs.HubConnection类的典型用法代码示例。如果您正苦于以下问题:C#Client.Hubs.HubConnection类的具体用法?C#Client.Hubs.HubConnection怎么用?C#Client.Hubs.HubConnection使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:BasicAuthCredentialsFlow
publicvoidBasicAuthCredentialsFlow(TransportTypetransportType)
{
using(varhost=newOwinTestHost())
{
Debug.Listeners.Clear();
host.Start
();
varconnection=newClient.Hubs.HubConnection(host.Url);
varhub=connection.CreateHubProxy("demo");
hub["name"]="test";
connection.Credentials=newSystem.Net.NetworkCredential("user","password");
connection.Start(CreateTransport(transportType)).Wait();
varresult=hub.InvokeWithTimeout("ReadStateValue");
Assert.Equal("test",result);
connection.Stop();
}
}
原文链接:http://www.jxszl.com/biancheng/C/556759.html