0

My chat program runs on a twisted server.When I open a page the icon place in tab has a rotating circle for entire time . I know that means an unfinished request .

Can anyone explain me what exactly is happening here ,its consequences and if possible a remedy ?

mayank vats
  • 444
  • 2
  • 6
  • 17

1 Answers1

2

rotating circle means one of the requestes issued by the browser is unfinished. In your scenario your webclient might be long polling, one of the remedies is to use iframe for such requests, other fix is to start your polling request by setTimeout, look here

In many browsers XMLHttpRequest doesn't set the loading status

Community
  • 1
  • 1
varun
  • 4,522
  • 33
  • 28
  • So does this make my server blocking.twisted pushes a message to client .so there is no case of polling as the unfinished request stays for entire time the connection is opened – mayank vats Jun 03 '13 at 19:26
  • no it doesnt, when I say polling, I really mean a single request here, "longpolling" is just a fancy word, you request can stay async both from client end and server. Basically longpolling is a never ending response because twisted will not close the tcp connection, if it times out then a new never ending connection is made. you just need to trick the browser into not showing a loading circle – varun Jun 03 '13 at 19:42
  • http push in comet protocol is actually a normal response in the original request connection , with a difference that the server does not tell the client that the response is finished,this simulates a push like behaviour – varun Jun 03 '13 at 19:45
  • also a doubt related to the topic.Will my twisted server be able to scale a large number of chat connections.somewhat like omegle. – mayank vats Jun 03 '13 at 19:53
  • its not really your twisted framework which alone decides this,scaling depends on many things, you may need to make your components distributed, it will also depend on where you persist the data, what you choose to cache in ram , how you decide to load balance. In general twisted is well known and tried and tested software with extremely good known results. Ps if you find my answer helpful dont forget to upvote and mark it as an answer – varun Jun 03 '13 at 20:01
  • so does a twisted.web server can be used to create a push behavior like xmpp.I mean which is by far not related to polling.server pushes message to client side without an open connection – mayank vats Jun 03 '13 at 20:02
  • short answer is yes, you can create an xmpp server in twisted framework look here http://twistedmatrix.com/trac/wiki/XMPPServerArchitecture. Don't get confused by the term poling, long-poling is not like a traditinal poling scenario where requests are made every second, this technique is used to make very long lasting requests which are not closed,instead data is channeled back and forth reusing the connection, in modern browsers people use websockets – varun Jun 03 '13 at 20:09
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/31148/discussion-between-mayank-vats-and-varun) – mayank vats Jun 03 '13 at 20:12
  • I tried calling the server from inside an iframe. But the rotating circle is still there. How to hide it ? – mayank vats Jun 03 '13 at 21:31
  • try initiating the call from a settimeout,make sure you mark your ajax req as async as well, this is all dependent on browsers – varun Jun 03 '13 at 21:36