try something like that :
In the root of the application, take two files named client.html and
server.html
-------------- server.html --------------------
Hello from server
-------------- /server.html--------------------
-------------- client.html ---------------------
<html>
<head>
</head>
<body>
<script language="javascript">
function getXHR(){
var xhr = null;
if(window.XMLHttpRequest) // Firefox et autres
xhr = new XMLHttpRequest();
else if(window.ActiveXObject){ // Internet Explorer
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
}
else { // XMLHttpRequest non supportÃ(c) par le navigateur
alert("Votre navigateur ne supporte pas les objets
XMLHTTPRequest...");
xhr = false;
}
return xhr;
}
function serverCall(){
var xhr = getXHR();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && xhr.status == 200){
alert(xhr.responseText);
}
}
xhr.open("GET","server.html",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send("");
}
</script>
<input type="button" value="click me" onclick="serverCall()">
</body>
</html>
------------- /client.html -------------------
open client.html with your navigator, and click the button. Normally, you
will be alerted by "Hello from server", and you will have an idea of how
many time it needs.
Regards,
Damien
2009/2/10 Rick <[email protected]>
>
> Hi all
>
> Thanks for your replies. Let me specify one more thing which might
> help us in figuring out my problem. My application server is in US and
> and I am accessing it from India. During a discussion with one of
> colleague, this point came that there should be a minimum time that a
> request will take for coming back from US based server. But we don't
> know what this minimum time should be in best & average conditions.
>
> Further, when I tried to ping google.com with command "ping google.com
> -t", I got following result:
>
>
> Pinging google.com [74.125.45.100] with 32 bytes of data:
>
> Reply from 74.125.45.100: bytes=32 time=370ms TTL=241
> Reply from 74.125.45.100: bytes=32 time=354ms TTL=241
> Reply from 74.125.45.100: bytes=32 time=340ms TTL=241
> Reply from 74.125.45.100: bytes=32 time=370ms TTL=241
> Reply from 74.125.45.100: bytes=32 time=341ms TTL=241
>
> Ping statistics for 74.125.45.100:
> Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
> Approximate round trip times in milli-seconds:
> Minimum = 340ms, Maximum = 370ms, Average = 355ms
>
> It is showing 355ms average time but total time elapsed in starting
> pinging and pausing for these 5 packets was 5 seconds. Then avg ping
> time should be around 1 sec. Now again I got more confused why it is
> showing 355ms.
>
> When I tried to ping my server, it's avg time was 375 ms.
>
> I also tested by returning a String value but same problem with it
> also.
>
> Regarding testing AJAX call using an example in core JS, I am sorry
> but I don't know how to write this as I have worked only in GWT for
> AJAX applications. It will be very helpful if one can provide such
> example or help in writing this.
>
> Please let me know if further I can provide some information which can
> help in figuring out my problem.
>
> Thanks and regards
>
> Rick
>
> On Feb 6, 9:19 pm, Jason Essington <[email protected]> wrote:
> > Just curious, what happens if you return a string, or an int rather
> > than a long?
> >
> > longs are emulated in GWT and have been pegged as being a bit slow,
> > but 1s sure seems like an awful lot.
> >
> > The other thing to do is pull up FireBug (Firefox), or WebInspector
> > (WebKit nightly builds) and check the latency of theRPCcall.
> >
> > What are the ping times to your remote server?
> >
> > -jason
> >
> > On Feb 6, 2009, at 3:49 AM, Rick wrote:
> >
> >
> >
> > > Hi
> >
> > > Thanks for reply.When I deploy application on local machine,RPCcall
> > > get returned in 20 ms but when this application get deployed on Remote
> > > server,RPCcallis taking 1000 ms. I am just returning a hard code
> > > long value from server.
> >
> > > Thanks and regards
> >
> > > Rick
> >
> > > On Feb 6, 2:46 pm, lowecg2004 <[email protected]> wrote:
> > >> Hi Rick,
> >
> > >> In my experienceRPCis very efficient - I have a 100 or so objects
> > >> serialising over the wire in less than 50ms, with simpler structures
> > >> taking even less time. Something that returns just a long should
> > >> complete in no time at all. Have you tried adding some timing logic
> > >> to
> > >> the server code that produces that long value? What timings do you
> > >> get
> > >> if you just return a hard long value? Using a HTTP proxy like
> > >> Charles
> > >> (http://www.charlesproxy.com/) will shed some light on the size of
> > >> theRPCcalls being made and will provide some more precise timings.
> >
> > >> Good luck,
> >
> > >> Chris.
> >
> > >> On Feb 6, 9:08 am, Rick <[email protected]> wrote:
> >
> > >>> Hi
> >
> > >>> I am using Java as server so I usedRPCcalls. The thing worrying me
> > >>> is theefficiencyofRPCcall. I just write a simple method
> > >>> getValue()
> > >>> on server which returns a long value. When I called it from
> > >>> client, it
> > >>> is taking 1 second to go to server and then come back. This 1 second
> > >>> time is pinching the performance of my application and I can't
> > >>> afford
> > >>> it. Can any one suggest what improvement should be done so that this
> > >>> time get reduced.
> > >>> Any suggestion in this regard will be highly appreciated .
> >
> > >>> Thanks and reagrds
> >
> > >>> Rick
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" 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/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---