Please enable JavaScript.
Coggle requires JavaScript to display documents.
W24 - Webhooks and Comet (Push/Pull Technology (Data Push (4 waves of data…
W24 - Webhooks and Comet
Push/Pull Technology
- Push: Internet based comm. where server sends data to client
- Pull is where the request for transmission is initiated by client
Data Push
-
4 waves of data push
Webcasting, comet, push notif, WebSockets
Comet
a web application model in which a long held HTTPS request allows a web server push data to a browser, without browser requesting for it
How does it work?
Offer two-way sustained interaction, using a persistent HTTP connection between server & client
Hidden iframe
- <iframe> automatically creates a persistent onnection to receiveData.php
- When an update is available at server, send data to update control of client
index.php
<iframe style="display:hidden;" src="http://localhost/comet/receiveData.php"></iframe>
<span id="update"></span>
Long Polling
whenever client makes request for update, server holds on the connection and provides response only when update available.
client initiates another request as soon as response is received
index.php
var ajax = new XMLHttpRequest();
ajax.open("GET", "data.php")
ajax.onload = function(){
if (ajax.readyState ==4 OR ajax.status == 200){
document.getElementById("update").innerHTML = ajax.responseText;
receiveData();
}
}
ajax.send();
}
receiveData();
-
Webhooks
What is it?
An application on the provider which notifies clients when an event of interest occurs
an HTTP POST callback request sent to URL of user's choice
-