Changeset 548

Show
Ignore:
Timestamp:
10/10/08 08:26:54 (6 weeks ago)
Author:
heyadayo
Message:

Auto detect Orbited.settings.hostname and Orbited.settings.port; Required morbid for install; Allow Orbited to use morbid to act as an embedded stomp broker.

Location:
trunk/daemon
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/daemon/orbited-debug.cfg

    r545 r548  
    22reactor=epoll 
    33proxy.enabled=1 
     4morbid.enabled=1 
    45session.ping_interval = 60 
    56session.ping_timeout = 70 
  • trunk/daemon/orbited/config.py

    r545 r548  
    88        #'reactor': 'epoll', 
    99 
    10         #'proxy.enabled': '1', 
    11  
     10        'proxy.enabled': '1', 
    1211        'pid.location': '/tmp/orbited.pid', 
    1312        'session.ping_interval': '30', 
  • trunk/daemon/orbited/start.py

    r545 r548  
    2525            reactor.listenWith(port_class, factory=factory_class(), resource=root, childName=child_path) 
    2626            logger.info('%s protocol active' % config_key) 
    27  
     27     
    2828def _setup_static(root, config): 
    2929    from twisted.web import static 
     
    4646    global logger; logger = logging.get_logger('orbited.start') 
    4747 
     48 
    4849    # NB: we need to install the reactor before using twisted. 
    4950    reactor_name = config.map['[global]'].get('reactor') 
     
    6162    static_files = static.File(os.path.join(os.path.dirname(__file__), 'static')) 
    6263    root.putChild('static', static_files) 
     64    #static_files.putChild('orbited.swf', static.File(os.path.join(os.path.dirname(__file__), 'flash', 'orbited.swf'))) 
    6365    site = server.Site(root) 
    6466 
     
    7072def start_listening(site, config, logger): 
    7173    from twisted.internet import reactor 
     74    # allow stomp:// URIs to be parsed by urlparse  
     75    urlparse.uses_netloc.append('stomp') 
     76 
    7277    for addr in config['[listen]']: 
    7378        url = urlparse.urlparse(addr) 
    7479        hostname = url.hostname or '' 
    75         if url.scheme == 'http': 
     80        if url.scheme == 'stomp': 
     81            logger.info('Listening stomp@%s' % url.port) 
     82            from morbid import StompFactory 
     83            reactor.listenTCP(url.port, StompFactory(), interface=hostname)      
     84        elif url.scheme == 'http': 
    7685            logger.info('Listening http@%s' % url.port) 
    7786            reactor.listenTCP(url.port, site, interface=hostname) 
  • trunk/daemon/orbited/static/Orbited.js

    r547 r548  
    25312531Orbited.JSON = JSON; 
    25322532 
     2533 
    25332534})(); 
     2535 
     2536 
     2537// Try to auto detect the Orbited port and hostname 
     2538(function() { 
     2539try { 
     2540    var scripts = document.getElementsByTagName('script') 
     2541    for (var i = 0; i < scripts.length; ++i) { 
     2542        var script = scripts[0] 
     2543        if (script.src.match('/static/Orbited\.js$')) { 
     2544            var url = new Orbited.URL(script.src) 
     2545            Orbited.settings.hostname = url.domain; 
     2546            Orbited.settings.port = url.port; 
     2547            break 
     2548        } 
     2549    } 
     2550} catch(e) { } 
     2551})() 
  • trunk/daemon/setup.py

    r545 r548  
    1515] 
    1616 
    17 _install_requires = [ "demjson" ] 
     17_install_requires = [ "demjson", "morbid" ] 
    1818 
    1919#if sys.platform != "win32":