Tornado Websocket
Lately i’ve been looking for an async web framework which will allow me to make async web apps in python. As you may know python servers are all blocking, meaning one event waits for another to finish before it starts. This of course is not a big problem unless you want to have a continuos process running without any on/off activity. After some searching i discovered Tornado web framework which is written in python. If you are not familiar with tornado, you can read more here: http://www.tornadoweb.org.
The main feature that i was interested in was the use of websockets. I wanted to see how exactly i could implement websockets and how they worked so i made a simple websocket server. Below is a tornado websocket server.py file which starts a server on port 8000.
For the client i normally use plain Javascript but you can use other websocket clients if you wish.
That’s it!! Runs server.py in command prompt then navigate to localhost:8000 in broswer. You should see a message in the console. This was just an introduction as there is a lot more you can do with this. That’s all for now!!