Does HTTP long polling support heartbeat message? -
i using http long polling pushing server events client.
on client side, send long polling request server , block there waiting event server.
on server side, used cometd framework (i on client side, not know server side).
the problem is, after sometime, connection broken , client can not detect this, blocks there forever. trying implement kind of heartbeat message, sent every n minutes keep connection active. not seem work.
my question is: http long polling support heartbeat messages? far understand, http long polling allows server send 1 event , close connection thereafter. client must reconnect , send new request in order receive next event. possible server sends heartbeat messages every n minutes while still keep connection open until real server event happens?
if use cometd framework, takes care of notifying application (both on client , on server) when connection broken, , send heartbeat messages.
what call "http long polling" normal http request, in not support heartbeat messages. can use http long polling requests implement heartbeat messages, , cometd under covers.
in cometd, response http long poll request may deliver multiple messages, , connection not closed afterwards. client send http long poll request without need reconnect, possibly reusing previous connection.
cometd offers application higher level api independent transport, can use websocket rather http, way more efficient, without changing single line in application.
you need use cometd libraries both on client (javascript , java) , on server, , work.
Comments
Post a Comment