ServiceStack Server Sent Events/push notification

2019-08-12 04:43发布

问题:

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.

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.

回答1:

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.

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'.