provide server side close option for EventStream
This commit is contained in:
parent
e0f655fb70
commit
6a1121ab2e
|
@ -44,8 +44,13 @@ OC.EventSource=function(src){
|
||||||
$('body').append(this.iframe);
|
$('body').append(this.iframe);
|
||||||
this.useFallBack=true;
|
this.useFallBack=true;
|
||||||
OC.EventSource.iframeCount++
|
OC.EventSource.iframeCount++
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//add close listener
|
||||||
|
this.listen('__internal__',function(data){
|
||||||
|
if(data=='close'){
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
}
|
}
|
||||||
OC.EventSource.fallBackSources=[];
|
OC.EventSource.fallBackSources=[];
|
||||||
OC.EventSource.iframeCount=0;//number of fallback iframes
|
OC.EventSource.iframeCount=0;//number of fallback iframes
|
||||||
|
|
|
@ -70,4 +70,11 @@ class OC_EventSource{
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* close the connection of the even source
|
||||||
|
*/
|
||||||
|
public function close(){
|
||||||
|
$this->send('__internal__','close');//server side closing can be an issue, let the client do it
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue