--- /dev/null
+<html>\r
+<body>\r
+<script type="text/javascript">\r
+window.onError = null;\r
+var domainparts = document.domain.split(".");\r
+document.domain = domainparts[domainparts.length-2]+"."+domainparts[domainparts.length-1];\r
+parent.Meteor.register(this);\r
+var streamreq;\r
+var byteoffset;\r
+var newdata;\r
+\r
+function abort() {\r
+ streamreq.abort();\r
+}\r
+\r
+function newXmlHttp() {\r
+ try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}\r
+ try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}\r
+ try { return new XMLHttpRequest(); } catch(e) {}\r
+ return null;\r
+}\r
+\r
+function startstream() {\r
+ streamreq = newXmlHttp();\r
+ byteoffset = 0;\r
+ newdata = "";\r
+ var url = parent.Meteor.getSubsUrl();\r
+ streamreq.open("GET", url, true);\r
+ streamreq.onreadystatechange = function() {\r
+ if (typeof streamreq == "undefined") return;\r
+ if (streamreq.readyState == 3) {\r
+ extractEvents(streamreq.responseText);\r
+ } else if (streamreq.readyState == 4) {\r
+ extractEvents(streamreq.responseText);\r
+ delete streamreq;\r
+ if (typeof(r)=="function") {\r
+ r();\r
+ }\r
+ }\r
+ }\r
+ streamreq.send(null);\r
+}\r
+\r
+function extractEvents(responsestr) {\r
+ newdata += responsestr.substring(byteoffset);\r
+ byteoffset = responsestr.length;\r
+ while (1) {\r
+ var x = newdata.indexOf("<s"+"cript>");\r
+ if (x != -1) {\r
+ y = newdata.indexOf("</"+"script>", x);\r
+ if (y != -1) {\r
+ eval(newdata.substring((x+8),y));\r
+ newdata = newdata.substring(y+9);\r
+ } else {\r
+\r
+ // Last message is incomplete. Ignore it and it will be processed next time\r
+ break;\r
+ }\r
+ } else {\r
+\r
+ // No more messages\r
+ break;\r
+ }\r
+ }\r
+}\r
+\r
+\r
+\r
+startstream();\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file