C++ 如何在Qt5中通过http连接到推送服务器

C++ 如何在Qt5中通过http连接到推送服务器,c++,qt,push,qt5,qtnetwork,C++,Qt,Push,Qt5,Qtnetwork,回顾QNetworkAccessManager,我没有看到任何与“推送”相关的内容。 与POST或GET不同,使用“推送”http连接时,您需要维护连接,以便能够从服务器接收定期更新。 Qt5中HTTP REST“推送”客户端连接使用的正确函数是什么?或者可能是一个持久的http连接?>如何使用QNetworkAccessManager连接到http推送服务器? > How would I use QNetworkAccessManager to connect to an http pu

回顾QNetworkAccessManager,我没有看到任何与“推送”相关的内容。 与POST或GET不同,使用“推送”http连接时,您需要维护连接,以便能够从服务器接收定期更新。 Qt5中HTTP REST“推送”客户端连接使用的正确函数是什么?或者可能是一个持久的http连接?

>如何使用QNetworkAccessManager连接到http推送服务器?
> How would I use QNetworkAccessManager to connect to an http push server?
*** Signoff: Raziel (Ping timeout: 265 seconds)
<thiago> pEYEd: what HTTP command do you need to send?
> thiago good point. I am not sure. It looks like json  https://www.cryptsy.com/pages/pushapi
*** sbw (~sbw@117.22.127.195) has joined channel #qt
<thiago> pEYEd: JSON is not an HTTP command
<thiago> try again: what HTTP command do you need to send?
> i know
*** Signoff: MagicHat (Quit: Leaving)
*** jankos (~js@203.215.119.190) has joined channel #qt
<thiago> pEYEd: let me try this: have you tried to simply get() the page?
*** TheCanadianBacon (~TheCanadi@CPEbc1401592013-CMbc1401592010.cpe.net.cable.rogers.com) has joined channel #qt
> it looks like POST
> http://pusher.com/docs/client_api_guide/client_connect
<thiago> then use post()
*** Signoff: nicolaf (Remote host closed the connection)
> thiago will it automatically do a persistant connection?
*** nicolaf (~nicola@static-217-133-54-77.clienti.tiscali.it) has joined channel #qt
<thiago> pEYEd: what exactly do you need to happen?
<thiago> it will keep giving you data as long as there's data to be given
> but it can't time out
*** Signoff: filipesaraiva (Read error: Connection reset by peer)
<thiago> once the data ends, the connection may be closed or reused. But you cannot and must not care about it.
<thiago> there's no timeout mechanism in QNAM
*** Hunts (~hunts@koln-4d0dd7cb.pool.mediaWays.net) has joined channel #qt
> no FIN/ACK unless specified?
<thiago> that's at a much lower level
<thiago> the HTTP request/reply ends when the server says it ends
> the connection can't close. no fin/ack
<thiago> under HTTP/1.1, it ends when the number of bytes specified in Content-Length is reached
*** Signoff: katmandoo (Ping timeout: 240 seconds)
<thiago> or the chunked encoding says it's the last chunk
<thiago> if either of those conditions happen, the QNetworkReply signals the end
<thiago> then QNAM can do whatever it wants to the socket
*** Signoff: saurabhsood91 (Remote host closed the connection)
> Thank you!
***签准:Raziel(Ping超时:265秒) 你需要发送什么HTTP命令? >蒂亚戈说得不错。我不确定。它看起来像jsonhttps://www.cryptsy.com/pages/pushapi ***sbw(~sbw@117.22.127.195)已加入频道#qt pEYEd:JSON不是HTTP命令 重试:您需要发送什么HTTP命令? >我知道 ***签准:MagicHat(退出:离开) ***扬科斯(~js@203.215.119.190)已加入频道#qt 佩耶德:让我试试这个:你有没有试过简单地获取()页面? ***加拿大培根(~TheCanadi@CPEbc1401592013-CMbc1401592010.cpe.net.cable.rogers.com)已加入qt频道 >它看起来像邮局 > http://pusher.com/docs/client_api_guide/client_connect 然后使用post() ***签准:nicolaf(远程主机已关闭连接) >thiago会自动进行持久连接吗? ***尼科拉夫(~nicola@static-217-133-54-77.clienti.tiscali.it)已加入qt频道 佩耶德:你到底需要做什么? 只要有数据要提供,它就会一直给你提供数据 >但它不能超时 ***签准:filipesaraiva(读取错误:对等方重置连接) 数据结束后,可以关闭或重新使用连接。但是你不能也不应该关心它。 QNAM中没有超时机制 ***狩猎(~hunts@koln-4d0dd7cb.pool.mediaWays.net)已加入通道#qt >除非另有规定,否则无FIN/ACK? 这是一个低得多的水平 当服务器说HTTP请求/应答结束时,HTTP请求/应答结束 >连接无法关闭。无财务/确认 在HTTP/1.1下,当达到Content Length中指定的字节数时,它结束 ***签署:加德满都(Ping超时:240秒) 或者分块编码表示这是最后一块 如果出现上述任一情况,QNetworkReply将发出结束信号 然后QNAM可以对套接字执行任何操作 ***签准:saurabhsood91(远程主机已关闭连接) >谢谢大家!!
是否有一个名为PUSH的HTTP动词?@Sleiman Jneidi通过REST API。基本上是一个持久的连接。那是动词吗?它与GET请求相同,但http会话永远不会结束。