Autor | Zpráva | ||
---|---|---|---|
Darker Profil |
Mám jednoduchý PHP skript generující po 20 sekund data a chci se na něj připojit rovněž jednoduchým AJAX požadavkem. Na localhostu mi vše funguje jak má, a data se po 20s stahují. Ale na VPS i hostingu se mi skript odpojí okamžitě po přijetí hlaviček:
function Streamer(ip,port) { var http = null; var buffer = ""; var seeker = 0; var _this=this; this.ip = ip; this.port=port; this.start = function() { http=new HTTPRequest(); http.open("GET", "http://"+this.ip+(this.port!=""?":"+this.port:""), true); http.onreadystatechange = readdata; http.send(null); } this.restart = function() { http.abort(); http=null; seeker=0; buffer=""; setTimeout(function() {_this.start();},500); } this.ondata = function(data) {console.log(data)}; function readdata() { if(this.readyState==3||this.readyState==4) { seektmp = seeker; while(seektmp<this.responseText.length) { /*parsování*/ } } if(this.readyState==4) { _this.restart(); } } } Zdroj PHP skriptu. |
||
_es Profil |
Darker:
Máš tam: var stream = new Streamer("127.0.0.1/arduino/proxy.php",""); new , no nespôsobí to chybu.
|
||
Časová prodleva: 11 let
|
0