简体   繁体   English

使用 signalr 实现 stream

[英]Implementing a stream with signalr

I have a simple Razor Page that I want to stream log data to use SingalR.我有一个简单的 Razor 页面,我想通过 stream 记录数据以使用 SingalR。

The difficulty I have found is gaining access to the Hub which would send data.我发现的困难是访问将发送数据的集线器。 I've seen some code examples using HostContext, but I'm not sure if some of it is deprecated or if because I am somehow using the AspNetcore and AspNet versions of SingalR, I am unable to use this method.我已经看到一些使用 HostContext 的代码示例,但我不确定其中一些是否已被弃用,或者是否因为我以某种方式使用 SingalR 的 AspNetcore 和 AspNet 版本,我无法使用此方法。

Is there an example or a design pattern for implementing a stream of one way data with SignalR?是否有使用 SignalR 实现单向数据的 stream 的示例或设计模式? the key is having other parts of the server process be able to send the log messages as well.关键是让服务器进程的其他部分也能够发送日志消息。

Is this the wrong technology for this?这是错误的技术吗? Are there any examples?有没有例子?

Wrong technology - No but some research would show you this is not being approached properly.错误的技术 - 不,但一些研究会告诉你这没有被正确处理。

You stated "using the AspNetcore and AspNet versions of SingalR, I am unable to use this method."您说“使用 SingalR 的 AspNetcore 和 AspNet 版本,我无法使用此方法。” This is simply because ASP.NET Core SignalR isn't compatible with clients or servers for ASP.NET SignalR.这仅仅是因为 ASP.NET 内核 SignalR 与 ASP.NET Z358E3E3FD9C2A4E3526F 的客户端或服务器不兼容。 (source) You need to pick which one you need but this will be obvious as shown below. (来源)你需要选择你需要的,但这很明显,如下所示。

Are there any examples?有没有例子? - ASP.NET Core SignalR now supports streaming data from the hub to the client. - ASP.NET 核心 SignalR 现在支持从集线器到客户端的流数据。 (source) SignalR (.NET 4.x) does not support streaming, although you can send data to the client at high rate, about 25 messages per second, it's not actual streaming. (source) SignalR (.NET 4.x) 不支持流式传输,虽然您可以高速向客户端发送数据,大约每秒 25 条消息,但这不是实际的流式传输。 Streaming Example 流式传输示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM