Why does opening the Chrome Console solve long wait issue? - django

My colleagues & I are building an Angular 4 app with a Django back-end. Periodically we have to wait a long time for a request to go out from the UI to the web-server. Yet if one opens up the Chrome Console then this seems to effect the request to immediately go out and provide the desired response.
We're trying to get a handle on what's going on. Any ideas?
Robert

Related

How can React Native be used to interface with an Amazon Connect Contact Control Panel (CCP)?

Since I couldn't find the answer after hours of searching, my first attempt was to load a WebView in React Native and point it to a custom CCP page hosted on my own server using Amazon Connect Streams. This is the method which seems well documented, but it is intended for desktops. It works great in Firefox on desktop and mobile (Android). When I try it in Chrome or the React Native WebView, it fails.
Developer tools on the desktop version of Chrome gives this error: Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'sameorigin'. Obviously, I don't have control over Amazon's X-Frame-Options but I don't think that's really the main problem. The other error shown in the console is: amazon-connect.js:204 [2020-07-14T22:12:32.258Z] [WARN]: ACK_TIMEOUT occurred, attempting to pop the login page if not already open. WARN # amazon-connect.js:204 amazon-connect.js:205 [2020-07-14T22:12:32.262Z] [ERROR]: ACK_TIMEOUT occurred but we are unable to open the login popup. I don't know what to do about this one.
I've also looked at the AWS.Connect API documentation, but it only seems to allow the customer side of a connection.
Has this been done before? If so, could someone give the broad strokes of it? I want to create an app which can connect to the Amazon CCP and maintain the connection so the agent can get an alert as soon as a chat attempt comes in.
Alternative solutions would be appreciated as well.
Update: There is a library from Amazon called amazon-connect-chatjs which looks promising, but I'm not sure if it will allow for the agent side of the chat session. I'm reading about it now.

Django development server hangs and suddenly does all requests on CTRL+C

I am using django for a REST API at my company and have a few people using the first small part of my app via a Samsung tablet. They connect via WiFi to a angular front-end on Apache, that makes API requests to my django development server.
But every now and again the server just freezes intermittently. The front end would work and you can navigate it, but no API calls are going through. And then when ever I press CTRL+C on the development server console, suddenly all the request go through. Depending on how long someone have struggle, there may be 20 API requests that all go through.
At these moments even when I change something in Django in vs-code, nothing happens server side, but when I press CTRL+C suddenly even ALL the server restarts also go through. So I can see that all the request are standing in line just waiting for the server to wake up and then they are all processed. It also looks to me if this mostly happens with the tablet (and not my desktop), where we are using Chrome.
I read that the server is now multi threaded, so that can not be the problem, and I also do not have anti-virus that can stop the server requests.
I do not really know what else to say, it has been 2 weeks of frustration now and continual searching for answer with no luck.
I suspect that the issue is with you using the dev server, where one request is taking too long. If you already have apache installed you can use mod_wsgi to connect to Django like described here
Django With Apache

External request limit on IIS

I have deployed django application on IIS. The application requests external link (API) to extract some data.
What I have seen is, it makes requests but fails to complete full request. It goes for about 4 request sometimes it goes further 9 requests and stops there. No sign of error is shown.
While I perform same task from django shell, all requests are made. So I guess this is something related to IIS.
I am new to IIS and windows server app deployment.
I tried googling about this but I could not find any relevant answer.
Did anyone of you here faced similar problem? If so what can be the solution. Also can you guide me on this?

Django Comet/Long Pollling application

I am working a real-time lighting control system.
User can turn on/off lights through web interface, but when another person turn on/off light switch manually the web interface should be updated immediately. That's the real-time goal I want.
The structure of the system is like this.
I have my own server at home, which control/monitor light status real-time. Django project is on my cloud server communicating with my home server real-time.
I have searched some similar posts and found many tools that confuse me a lot. All I want is to do long polling. User's browser will send http request to django server periodically(say 30s). If nothing comes up, server will hold the response until next one come. If there is an event, server will just reply immediately so real-time change at the browser side.
I know websocket is a better way, but I just want to make it work, the simpler the better. As long as it's reliable, compatible with existing browsers, performance is not a primary concern for me now. I can change it later if there is performance issue when scaling up. If it's possible, I still want to use Apache server to do this.
Does anyone knows a good tutorial or example that shows me how to implement it?
Thanks so much
I use Django 1.4, wsgi, Apache.

Dojo DOH, unit tests with robot actions wont run

When try to run dijit tests from 1.7 version, popup window shows up and test will not progress any further.
Popup says:
DOH has detected that the current web page is attempting to access DOH, but belongs to a different domain than the one you agreed to let DOH automate. If you did not intend to start a new DOH test by visiting this Web page, press Cancel now and leave the Web page
Clicking OK or Cancel doesn't do anything.
Whats going on a how to fix this?
Browser is Firefox 9, java is working (at least test page say so).
It's slightly hard to tell what the problem is, as you've not said whether you're running this from a local filesystem or under a web server, or which URL you're using.
I've had various problems trying to get DOH Robot running from the local filesystem, but good success running them under a web server.
Try it under a web server (any type will do), and try visiting the URL
http://server:port/ROOTDIR/util/doh/runner.html?testModule=dijit.tests.form.module
(where http://server:port/ROOTDIR/ points to the top of your Dojo SDK directory)
That works fine for me with Dojo SDK 1.7.2; sometimes I then get the same prompt you get, but OK enables the test to continue happily.
If that doesn't work, see if you can run a test page directly without the DOH browser runner wrapped around it, e.g.
http://server:port/ROOTDIR/dijit/tests/form/robot/Button_mouse.html
That might prove easier to diagnose.