Changeset 37

Show
Ignore:
Timestamp:
02/06/08 20:39:26 (4 years ago)
Author:
mike
Message:

got cometd to work!

Files:
4 modified

Legend:

Unmodified
Added
Removed
  • cometd.py

    r36 r37  
    304304 
    305305                                self.stream.write( 
     306                                        self.ctypeProps["envelope"] % ( 
    306307                                                simplejson.dumps(self.backlog), 
     308                                        ) 
    307309                                ) 
    308310 
  • tabled.py

    r36 r37  
    1414from twisted.application import internet, service, strports 
    1515from twisted.web2 import http, resource, channel, stream, server, static, http_headers, responsecode 
     16from path import path 
    1617import cometd 
    1718 
     
    186187""" 
    187188#cometd.verbose = False 
     189class CometdRunner(resource.Resource): 
     190    # blah, hacky class. Wish we didn't need it 
     191    addSlash = True 
     192    child_web = static.File(path("web").abspath()) 
     193    child_cometd = cometd.cometd() 
     194    child_cometd.ClientType = WebClient 
     195    #child_cometd 
     196    def render(self, ctx): 
     197        return http.Response( stream="hi") 
     198 
    188199 
    189200port = 8007#int(sys.argv[1]) 
     
    193204factory.protocol = PokerTableProtocol 
    194205 
    195 comet = cometd.cometd() 
    196 comet.ClientType = WebClient 
    197  
    198 site = server.Site(comet) 
     206 
     207site = server.Site(CometdRunner()) 
    199208application = service.Application("cometd") 
    200209 
  • web/js/jquery.comet.js

    r36 r37  
    131131                        { 
    132132                                $.ajax({ 
    133                                         url: sUrl+'?jsonp=?', 
     133                                        url: sUrl, 
    134134                                        type: 'post', 
    135135                                        beforeSend: function(oXhr) { oXhr.setRequestHeader('Connection', 'Keep-Alive'); }, 
  • web/js/poker-client.js

    r36 r37  
    174174        //$("form#connect_form").hide(); 
    175175                // 
    176                 $.comet.init("http://localhost:8080"); 
     176                $.comet.init("/cometd"); 
    177177                $.comet.subscribe("/poker", processStatus); 
    178178