Show you my code ? :/
I think it's not possible it's too big.
Else to wait in my application between 2 command sending I use a key
(onkeydown) which start a function which send the request.
In my function i've that :
function move (direction, map) {
if(application.player.moveState === true) {
application.Pipe.request.send('application', { cmd: "Move", move:
direction, session: application.SESSION });
}
var starttime = new Date().getTime();
var retour = application.player.deplacer(direction, map); // in
this method, if application.player.moveState === false, it return false
if (retour) {
var xhr = application.getXHR();
delete
application.map.personnages[application.Y][application.X][<?php echo
$_SESSION['id'] ?>];
application.map.collision[application.Y][application.X].taille--;
application.player.moveState = false;
var time = (700 - (new Date().getTime() - starttime));
if (time > 0) { setTimeout("application.player.moveState = true;", time); }
else { setTimeout("application.player.moveState = true;", 1); }
switch(direction) {
case application.DIRECTION.DOWN :
application.Y++;
break;
case application.DIRECTION.LEFT :
application.X--;
break;
case application.DIRECTION.RIGHT :
application.X++;
break;
case application.DIRECTION.UP :
application.Y--;
break;
}
application.map.addPersonnage(application.player,
application.X, application.Y, application.id);
}
}
So when i press my key, it send the request every 800 ms and between 2
requests, i've a check request.
Le mercredi 18 juillet 2012 20:39:44 UTC+2, Auryn a écrit :
>
> Hi everybody ! :)
>
> So I've an application where i send a request (with pipe.request) every
> 800 ms, and i've a little problem.
> When I send the request, the check request are breaking and after 2
> request are sending one for my request and one for check wich is instantly
> breaking by my next request :
> Exemple of the check request :
> [{"cmd":"CHECK","chl":13,"sessid":"....................................................................."}]:
>
> Too many request are sending, so it work but i've sometimes the errors
> "BAD_CHL" or "BAD_SESSION".
>
> It's possible to not break the check request when I send a request ? :o
> (Like have 2 requests in the same time, one for send my request and one for
> check)
> Else what can I do ?
>
> (Anyone says me that's the last version of APE solves the BAD_CHL's
> problem but I can't upgrade my APE for the moment cause my hoster is in
> holiday. :/)
>
> Thanks very much ! ^^
>
> P.S : Sorry for my bad english i'm french... :(
>
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/