an event-source demo
use event-source to make a progress bar of demo
- scan qr-code to login
- php
$eventSource = new EventSource;
$lastEventId = $eventSource->getLastEventId();
$eventSource
->setLastEventId(1)
->setData([])
->setEvent('ProgressEvent')
->setRetry(1000)
->output();
- js
_EventSource("demo.php",
[
{
//Custom Event
event:'ProgressEvent',
callback:function(data)
{
//code...
}
},
{
//default Event
callback:function(data)
{
}
}
]);