This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django Socket Server

Quickstart

  1. Install django-socket-server:

    pip install django-socket-server
    
  2. Add socket_server to INSTALLED_APPS:

    INSTALLED_APPS = (
        ...
        'socket_server',
        ...
    )
    

Create a sockets.py in an application of your project.

django-socket-server will discover the socket files that are in applications installed against Django.

An example sockets.py looks like this:

from socket_server.namespace import EventNamespace


class Namespace(EventNamespace):

    def client_connected(self, client):
        super(Namespace, self).client_connected(client)

        print 'Send ping'
        self.emit_to(client, 'ping')

    def register_callbacks(self):
        return {
            'pong': self.pong
        }

    def pong(self, client, **kwargs):
        print 'Received pong event'

Messages are sent and received in JSON, and always contain an event key. This key is then mapped to callbacks, added inside register_callbacks.

You can specify a namespace name using the name property like so:

class Namespace(EventNamespace):
    name = 'pingpong'

If you do not specify a name, the app name will be used by default.

Start Socket Server

Use the management command provided to start the socket server: python manage.py start_socket.

You may pass an optional --port to override the default port of 3000.

Client connection

The above example would expose the following: ws://localhost:3000/pingpong

Documentation

The full documentation is at https://django-socket-server.readthedocs.org.

History

0.0.1 (2015-01-01)

  • First release on PyPI.

0.0.2 (2015-01-30)

  • Added python client classes

0.0.3 (2015-01-30)

  • Catch server shutdown and pass to namespaces

0.0.4 (2015-02-01)

  • Remove debugging and add “room” event errors
Release History

Release History

0.0.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-socket-server-0.0.4.tar.gz (9.2 kB) Copy SHA256 Checksum SHA256 Source Feb 1, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting