Skip to content

Instantly share code, notes, and snippets.

@bcoe
Created July 22, 2010 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcoe/485408 to your computer and use it in GitHub Desktop.
Save bcoe/485408 to your computer and use it in GitHub Desktop.
import thread, time
import socket
from hackwars.orbited_server.comet import handle_request
from orbited import start
def listen():
try:
comet_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
comet_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
comet_socket.bind( ('', 9000) )
comet_socket.listen(5)
while 1:
thread.start_new_thread(handle_request, comet_socket.accept())
except Exception, e:
print str(e)
@bcoe
Copy link
Author

bcoe commented Jul 22, 2010

Orbited connects to port 9000 at which point the thread listening to RabbitMQ is spawned off.

@dr-alberto
Copy link

@bcoe How would be the way of implement this comet server in a Django app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment