Online Mind Mapping and Brainstorming

Create your own awesome maps

Online Mind Mapping and Brainstorming

Even on the go

with our free apps for iPhone, iPad and Android

Get Started

Already have an account? Log In

Doing comet in Python using gevent, Uriel Katz by Mind Map: Doing comet in Python using gevent, Uriel Katz
0.0 stars - reviews range from 0 to 5

Doing comet in Python using gevent, Uriel Katz

easy to use, co-routine-based networking library for python

abstract is, & lets you write regular threading code


loads the server, network, &c


CTO @ BinFire


Open-source COMET server released by Uriel

Non blocking servers

at the heart of every non-blocking networking framework

most are single-threaded

event handling must be as fast as possible

using single threads leads to low memory consumption

there are 2 common ways to do it


aka green-threads, greenlets

Similar to kernel level threads

Kind of userland cooperative multi-tasking

each has its own stack in the heap


the co-routine actually does the select call

has a really fast wsgi server

must be very careful not to block

monkey-patches python

Pushing data to the client

When web clients need real-time updates

We need a way to push information, without it being requsted

But HTTP only supports request model

few ways

Architecture of Shaveet

Based on gevent wsgi server

Messages & clients are stored in-memory

Exposes API in JSON-RPC

No authentication betweeb webapp & Shaveet, only the webapp should access Shaveet JSON-RPC API

Each client has a secret key used for getting notifications from Shaveet

built around a pub/sub paradigm

in each chennel, loop on connected clients & send notifications

Taking out the trash - GC

Clients can come & go, & Shaveet needs to be aware of it

Goes over all clients periodically


a Python WSGI protocol, exposing API

create_client ( client_id )

subscribe ( client_id, channel_name )


new_message ( client_id, message, channel_name )

get_client_channels ( client_id )



import Shaveet.js


You send messages via the webapp, not Shaveet