Giter VIP home page Giter VIP logo

django-gevent-socketio's Introduction

Django Gevent SocketIO

A project to encapsulate the django example included in gevent-socketio into a resusable django application, compatible with the latest version of django, and not using the bootstrap pattern, opting instead for the traditional django application format.

Most of this code is ripped wholesale from socket.io and gevent-socketio, just packaged together by me.

Quick start

  1. Add "django_gevent_socketio" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = (
        ...
        'django_gevent_socketio',
    )
    
  2. Include the basic socketio URLconf in your project urls.py like this:

    url('', include('django_gevent_socketio.urls')),
    
  3. In your templates, load the scripts via a couple of simple tags, place the second tag somewhere near where your other JS is loaded:

    {% load gevent_socketio %}
    
    ...
    
    {% socketio_js %}
    
  4. The app provides a simple echo test to verify everything is working. To try this, add the following into your html:

    <script type="text/javascript">
        var socket = io.connect('/gevent_socketio_isworking');
        socket.on("echo", function(message) {
            alert(message);
        });
        socket.emit('echo', 'Some test message');
    </script>
    
  5. Run the gevent development server with (note, regular 'manage.py runserver' will not suffice):

    ./manage.py runserver_socketio
    

Refer to the test application ('django_socketio_tests') for very basic example. For more information and examples, refer to the sites above.

Thanks

To the authors of socket.io and gevent-socketio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.