ServiceStack 服务器发送事件/推送通知 (SSE) [英] ServiceStack Server Sent Events/push notification (SSE)

查看:74
本文介绍了ServiceStack 服务器发送事件/推送通知 (SSE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以指导我了解服务器发送事件在服务堆栈框架中的工作方式.我想获得异步加载的响应.如果响应包含项目列表,我希望在服务处理列表时填充项目列表.

Can anyone guide me as how server sent events works in servicestack framework. I want to get response to load asynchronously. If a response contains a list of items, I want the list of items to populate while the service is processing the list.

假设,我有一个响应对象, company ,其中包含来自两个不同来源的永久员工列表和合同员工列表.我希望响应对象填充首先处理的员工列表.我不想等待响应对象绑定正式员工和合同员工的列表,然后将结果发送给我.一旦处理了永久雇员名单,它应该立即向我发送回复.请指导我如何实现此功能.

Suppose, I have a response object, company which contains list of permanent employee and list of contractual employee which comes from two different sources. I want the response object to populate the list of employees which is processed first. I don't want to wait for the response object to bind the list of permanent employees and contractual employees and then send me the result. Once the list of permanent employee is processed, it should send me the response immediately. Please guide me how to achieve this functionality.

推荐答案

据我了解您的问题,客户端不想等到服务器处理完数据,因此您希望在此之前不断获取数据.

As far as I understood your question, client doesn't want to wait till server finished processing the data and therefore you want to get the data before that, continuously.

因此,如果您很灵活并且可以为此目的使用其他一些技术,我建议您使用 SignalR.服务器将能够在流中"将数据推送到客户端.

So, if you are flexible and can use some other technology for that purpose I suggest using SignalR. Server will be able to push data to client 'in a stream'.

这篇关于ServiceStack 服务器发送事件/推送通知 (SSE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆