SSE Client request which does not terminate c#

柔情痞子 提交于 2019-12-08 08:45:28

问题


I am using C# to connect to a web service. I am need to send a GET request to monitor some transactions, and the web service will be sending the transactions to me continuously without breaking the connection. The web service provider said I need to connect to them with a http library that supports SSE.

I have tried using HttpWebRequest and HttpClient to send request and receive response, but both of my attempt failed. I don't get response from the web service.

My question is: The web service will send the transactions to me without breaking the connection, but how do I keep the connection up? Do I have to set up a socket for listen after I send the GET request?

Thank you, kab


回答1:


I have the issue resolved. So basically, I send a httpclient request, then I tie the response stream to an event handler, so whenever there is data on the stream, the event will be raised.

Thanks for all of your inputs. kab



来源:https://stackoverflow.com/questions/27297272/sse-client-request-which-does-not-terminate-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!