我正在使用
使用owinstartup将IObservable传送到我的集线器 一切都很好(AFAICT)
但是在我的JavaScript和.NET客户端中,我发现了一个问题:
这是第二个客户发送的消息(当它不工作时)
Sending outgoing message. Connection id: 12e1a17f-5f48-4e66-aece-166957d645cf, transport: WebSocketTransport,
message: {"C":"d-142AA7E2-B,0|J,0|K,2|E,B3","M":[]}
然后连接第三个客户端 第二个客户得到这个(这确实有效):
Sending outgoing message. Connection id: 12e1a17f-5f48-4e66-aece-166957d645cf, transport: WebSocketTransport,
message: {"C":"d-142AA7E2-B,0\|J,0\|K,2\|E,B4","M":[{"H":"StreamHub","M":"receiveCallCanceled","A":[{"BaseTime":717006987,"BedIndex":2,"CallIndex":4,"EscalationIndex":5,"CallPlacedUTCTime":"2017-09-20T04:52:12.9831051Z","ServerSentUTCTime":"2017-09-20T04:52:15.4492756Z","FacilityGuid":"11111111-1bad-f00d-1111-111111111111","DialString":"1*111"}]}]}
注意connectionid是一样的 似乎" M":[]是客户端没有收到回调的原因。是什么造成的?
StartupOwin.cs
builder.Register(c =>
{
try
{
return new PCConsoleStreamObservable(c.Resolve<IClientGrainFactory>(),
c.Resolve<IFacilityConfigurationClient>());
}
catch (Exception ex)
{
System.Diagnostics.Trace.TraceError($"{ex}");
throw;
}
})
.As<IObservable<XXXClientBase>>()
.InstancePerLifetimeScope()
.AutoActivate();
builder.RegisterHubs(typeof(WebApiApplication).Assembly);
var hubConfiguration = new HubConfiguration()
{
//EnableJavaScriptProxies = true,
//EnableJSONP = false,
EnableDetailedErrors = true,
Resolver = new Autofac.Integration.SignalR.AutofacDependencyResolver(container)
};
app.UseAutofacMiddleware(container);
app.UseAutofacWebApi(httpConfig);
app.UseAutofacMvc();
app.UseWebApi(httpConfig);
app.Map("/signalr", map =>
{
map.RunSignalR(hubConfiguration);
});
StreamHub.cs
public class StreamHub : Hub
{
private readonly IObservable<XXXClientBase> _observer;
public StreamHub(IObservable<XXXClientBase> observer) : base()
{
this._observer = observer;
}
答案 0 :(得分:0)
群组似乎是问题
Clients
.OthersInGroup(SignalRNameHelpers.GenerateStreamHubName(subscription))
.receiveCallPlaced(outbound);
删除该群组并发送至All
修复此问题
Clients
.All
.receiveCallPlaced(outbound);