Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Real Time Web Server
• Real Time, so what?
• Tornado – The baby that comes with it
• 1000s simultaneously active connections
•
•
•
•
•
•

Open-source (Apache 2.0 License)
Nginx
Non-blocking web server
Epoll (callbacks on the kernel file structure)...
- Module List

web
escape

•FriendFeed
•core
•XHTML
•JSON
•URL encoding/decoding

database

•MySQL

template

•Python-base...
- Code Snippets
• URL Mapping (get + post)
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("You r...
- Code Snippets
• HTML Templates
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<ul>
{% for item in items %}
<li>...
- UI Modules

Blog Post 1
myModule.py

<short python code here…>

Blog Post 2

Web Page
- Asynchronous Requests

1. Fetch data

www.website.com

Picasa/Flickr

2. Response (callback)

Synchronous Requests
• imm...
- References

Non-blocking

Long-polling

Asynchronous

Tornado
Epoll man page
Long Pooling
CSRF

-

modular

CSRF
Protect...
http://www.slideshare.net/ConstantinePriemski/tornado

Thank YOU!
Upcoming SlideShare
Loading in …5
×

Tornado my

1,415 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Tornado my

  1. 1. Real Time Web Server
  2. 2. • Real Time, so what? • Tornado – The baby that comes with it • 1000s simultaneously active connections
  3. 3. • • • • • • Open-source (Apache 2.0 License) Nginx Non-blocking web server Epoll (callbacks on the kernel file structure) Push vs Pull (long polling) Real-time web services
  4. 4. - Module List web escape •FriendFeed •core •XHTML •JSON •URL encoding/decoding database •MySQL template •Python-based templating language httpClient auth S3Server •Non-blocking http client •Works with web module •Google OpenID/OAuth, Yahoo BBAuth •Facebook Platform • Twitter OAuth •Amazon S3
  5. 5. - Code Snippets • URL Mapping (get + post) class MainHandler(tornado.web.RequestHandler): def get(self): self.write("You requested the main page") class StoryHandler(tornado.web.RequestHandler): def get(self, story_id): self.write("You requested the story " + story_id) application = tornado.web.Application([ (r"/", MainHandler), (r"/story/([0-9]+)", StoryHandler), ]) • Post arguments class MainHandler(tornado.web.RequestHandler): def get(self): self.write('<html><body><form action="/" method="post">' '<input type="text" name="message">' '<input type="submit" value="Submit">' '</form></body></html>') def post(self): self.set_header("Content-Type", "text/plain") self.write("You wrote " + self.get_argument("message")) • HTTPRequest
  6. 6. - Code Snippets • HTML Templates <html> <head> <title>{{ title }}</title> </head> <body> <ul> {% for item in items %} <li>{{ escape(item) }}</li> {% end %} </ul> </body> </html> • Template Handler class MainHandler(tornado.web.RequestHandler): def get(self): Items = ["Item 1", "Item 2", "Item 3"] self.render("template.html", title="My title", items=items)
  7. 7. - UI Modules Blog Post 1 myModule.py <short python code here…> Blog Post 2 Web Page
  8. 8. - Asynchronous Requests 1. Fetch data www.website.com Picasa/Flickr 2. Response (callback) Synchronous Requests • immediate server response • cannot later-update the client Asynchronous Requests • immediate server response • allows for 3rd party services • push technologies
  9. 9. - References Non-blocking Long-polling Asynchronous Tornado Epoll man page Long Pooling CSRF - modular CSRF Protection Web Server Signed Cookies http://www.tornadoweb.org/ http://linux.die.net/man/4/epoll http://en.wikipedia.org/wiki/Push_technology http://en.wikipedia.org/wiki/Cross-site_request_forgery Q/A minute Hack it now…
  10. 10. http://www.slideshare.net/ConstantinePriemski/tornado Thank YOU!

×