diff --git a/core/js/eventsource.js b/core/js/eventsource.js
index 422f97657bd6e739b4e851e9d7d3a7e75e5c3375..30b942f59e8ac9e1079532fbf4f8d5a8941c4b44 100644
--- a/core/js/eventsource.js
+++ b/core/js/eventsource.js
@@ -44,8 +44,13 @@ OC.EventSource=function(src){
 		$('body').append(this.iframe);
 		this.useFallBack=true;
 		OC.EventSource.iframeCount++
-
 	}
+	//add close listener
+	this.listen('__internal__',function(data){
+		if(data=='close'){
+			this.close();
+		}
+	}.bind(this));
 }
 OC.EventSource.fallBackSources=[];
 OC.EventSource.iframeCount=0;//number of fallback iframes
diff --git a/lib/eventsource.php b/lib/eventsource.php
index c123eb4b837c5be1b66a9dca79982b6475a6d474..b0450ff3d55d63bbeb594cdd4e73012b67a17ee7 100644
--- a/lib/eventsource.php
+++ b/lib/eventsource.php
@@ -70,4 +70,11 @@ class OC_EventSource{
 		echo PHP_EOL;
 		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
+	}
 }
\ No newline at end of file