I want to share my local WebSocket on the internet but ngrok only support HTTP but my ws.py address is ws://localhost:8000/
it is good working on localhost buy is not know how to use this on the internet?
You can use ngrok http 8000 to access it. It will work. Although, ws is altogether a different protocol than http but ngrok handles it internally.
Related
We have two tornado/webssh servers and we're using a loadbalancer to distribute the traffic
the loadbalancer works fine with https since it depends on the cookie but in https mode the webssh sessions not working and it's because the loadbalancer depends on the sessionid for persistence and tornado doesn't support sessions , there is another option in the loadbalancer to use ip source but we can't depend on that since the users are using a proxy and the ip changes
do you guys know how to solve this issue ?
thanks in advance
I am trying to deploy a Flask web app on google compute engine and am wondering:
What is the best instance type to use, is a g1-small sufficient?
What network traffic do I allow for the instance, HTTP and HTTPS or just one of them?
What port do I allow for the instance? I saw some people mentioned using tcp 5000.
Any other tips on instance or firewall specs would be much appreciated!
What is the best instance type to use, is a g1-small sufficient?
The answer depends on the traffic workload for your instance. Start with micro or small, monitor response time and adjust instance size to match the load.
What network traffic do I allow for the instance, HTTP and HTTPS or
just one of them?
That depends on what traffic/data you are serving. As a general rule, there is no reason to not implement HTTPS (SSL certificates) today.
What port do I allow for the instance? I saw some people mentioned
using tcp 5000.
You should not be serving using Flask's development server, which defaults to port 5000. Instead use a production server. You'll need to open whatever port you configure your server to listen on.
I am using http proxy in my python webbrowser. In my php script on server side I am still able to detect requests go through proxy. How can I mask it so other servers are not able to find out I am using http proxy?
Thank you.
Modify your proxy so it does not add the X-Forwarded-For header identifying the request as coming from a proxy.
If you don't control the proxy, you are SOL.
You could also, conceivably, use a SOCKS proxy instead of an HTTP one.
I am working on a game I want to support over iOS/Android/Browser and thinking Websockets is what I want to use for the communication. I use python and so found that I should be using Tornado.
I am trying to understand websockets a little better and their integration in browsers.
Will the messages over the websocket connection also contain the HTTP cookies for the connection? If not can I send it?
How is the HTTP connection for the web page linked to the websocket connection? I mean how will I know they are coming from the same webapp on the server side?
The Tornado wiki page says in the performance section that Tornado can be set up with nginx as the front end. How does that work? I thought Tornado and nginx have to be running on separate machines since both listen on port 80 and also because nginx does not understand WS protocol. What am I missing?
Also it will be great if someone can point me to any resources I can read up on about either Tornado or websocket that could help me.
The websocket is setup by sending an ordinary http request to the server, this request will contain all the stored cookies for the domain. If you do a native implementation for e.g. Android you can use libraries like Autobahn|Android, the API allows you to set cookies for the websocket handshake.
You can set a cookie when first loading the page to maintain a session identifier.
In that scenario they would be running 4 Tornado instances (on different ports, but not port 80) and Nginx on port 80 as a load-balancer, spreading the incoming client requests to the Tornado instances, see running Tornado and Nginx on same server for a configuration example. Recent versions of Nginx does support websockets, see e.g nginx + python + websockets.
I'm going to use ftplib to open up an FTP connection to an FTP server provided by the user. The client will be sending FTP commands to my django server via Ajax, which will then be forwarded to the FTP server the user provided. However, I'd like to not have to create a new FTP server connection every time the client sends an FTP command. In other words, I want to keep the FTP connection alive between requests by the client.
How would I do this? Would some sort of comet implementation be best? I was initially planning to use WebSockets until I discovered my host won't allow it. =\
You'll need to use a persistent connection framework as what you're trying to achieve really isn't what HTTP was meant for (in the sense that HTTP commands are stateless and independent), and thus not what Django is built for. There are a number of options, but since it seems you are in a restricted environment you'll need to do some research to determine what's best.
Switch hosts. Webfaction allows websockets with dedicated IP at around $20 per month.