TornadIO2

Socket.io 0.7+ server implementation on top of Tornado framework
Download

TornadIO2 Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Serge S. Koval
  • Publisher web site:
  • http://in-square.net

TornadIO2 Tags


TornadIO2 Description

TornadIO2 is Python server implementation of the Socket.IO realtime transport library on top of the Tornado framework.TornadIO2 is compatible with 0.7+ version of the Socket.IO and implements most of the features found in original Socket.IO server software.What is Socket.IO?Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. It's care-free realtime 100% in JavaScript.You can use it to build push service, games, etc. Socket.IO will adapt to the clients browser and will use most effective transport protocol available.Getting StartedIn order to start working with the TornadIO2 library, you have to have some basic Tornado knowledge. If you don't know how to use it, please read Tornado tutorial, which can be found here.If you're familiar with Tornado, do following to add support for Socket.IO to your application:1. Derive from tornadio2.SocketConnection class and override on_message method (on_open/on_close are optional): class MyConnection(tornadio2.SocketConnection): def on_message(self, message): pass2. Create TornadIO2 server for your connection: MyRouter = tornadio2.TornadioRouter(MyConnection)3. Add your handler routes to the Tornado application: application = tornado.web.Application( MyRouter.urls, socket_io_port = 8000)4. Start your application5. You have your socket.io server running at port 8000. Simple, right?Starting UpWe provide customized version (shamelessly borrowed from the SocketTornad.IO library) of the HttpServer, which simplifies start of your TornadIO server.To start it, do following (assuming you created application object before):if __name__ == "__main__": socketio_server = SocketServer(application)SocketServer will automatically start Flash policy server, if required.If you don't want to start IOLoop immediately, pass auto_start = False as one of the constructor options and then manually start IOLoop.More informationFor more information, check TornadIO2 documentation and sample applications.ExamplesAcknowledgmentPing sample which shows how to use events to work in request-response mode. It is in the examples/ackping directory.Cross siteChat sample which demonstrates how cross-site communication works (chat server is running on port 8002, while HTTP server runs on port 8001). It is in the examples/crosssite directory.Events and generator-based async APIExample which shows how to use events and generator-based API to work with asynchronous code. It is in the examples/gen directory.MultiplexedPing and chat demo running through one connection. You can see it in examples/multiplexed directory.StatsTornadIO2 collects some counters that you can use to troubleshoot your application performance. Example in examples/stats directory gives an idea how you can use these stats to plot realtime graph.RPC pingPing which works through socket.io events. It is in the examples/rpcping directory.TransportsSimple ping/pong example with chat-like interface with selectable transports. It is in the examples/transports directory.Product's homepage


TornadIO2 Related Software