def get_instance(cls, app): if app in Environment.channels: return Environment.channels[app] else: instance = App() instance.name = app Environment.channels[app] = instance return instance
def post(self, app=None): self.app = App.get_instance(app) self.set_header("Access-Control-Allow-Method", "POST, OPTIONS") self.set_header("Access-Control-Allow-Headers", "Content-Type") self.set_header("Content-Type", "application/json") self.finish('{"URL":"ws://%s/session/%s?%s","pingInterval":3}' % (self.request.host, app, self.app.get_apps_count())) self.app.create_application_channel(self.request.body)
def post(self, app=None): self.app = App.get_instance(app) self.set_header("Access-Control-Allow-Method", "POST, OPTIONS") self.set_header("Access-Control-Allow-Headers", "Content-Type") self.set_header("Content-Type", "application/json") self.finish( '{"URL":"ws://%s/session/%s?%s","pingInterval":3}' % (self.request.host, app, self.app.get_apps_count()) ) self.app.create_application_channel(self.request.body)
def post(self, app=None): self.app = App.get_instance(app) self.set_header( "Access-Control-Allow-Method", "POST, OPTIONS") self.set_header("Access-Control-Allow-Headers", "Content-Type") self.set_header("Content-Type", "application/json") ## TODO: Use information from REGISTER packet ## TODO: return url based on channel property ## TODO: defer request until receiver connects self.finish( '{"URL":"ws://%s/session/%s?%s","pingInterval":3}' % ( self.request.host, app, self.app.get_apps_count()) )
def post(self, sec): '''Start app''' self.clear() self.set_status(201) self.set_header('Location', self._getLocation(self.get_name())) status = self.get_app_status() if status['browser'] is None: status['state'] = 'running' appurl = render(self.url).generate(query=self.request.body) status['browser'] = Browser(appurl) status['connectionSvcURL'] = 'http://%s/connection/%s' % ( self.ip, self.get_name()) status['protocols'] = self.supported_protocols status['app'] = App.get_instance(sec) self.set_app_status(status) self.finish()
def post(self, sec): '''Start app''' self.clear() self.set_status(201) self.set_header("Location", self._getLocation(self.get_name())) status = self.get_app_status() if status["pid"] is None: status["state"] = "running" status["link"] = '''<link rel="run" href="web-1"/>''' status["pid"] = self.launch(self.request.body) status["connectionSvcURL"] = "http://%s/connection/%s" % ( self.ip, self.get_name()) status["protocols"] = self.protocols status["app"] = App.get_instance(sec) self.set_app_status(status) self.finish()
def open(self, app=None): self.app = App.get_instance(app) self.cname = self.__class__.__name__ logging.info("%s opened %s" % (self.cname, self.request.uri))
def open(self, app=None): self.app = App.get_instance(app) self.app.set_control_channel(self) while len(self.buf) > 0: self.reply(self.buf.pop())
def run(self): # self.lock.wait(30) self.lock.clear() self.lock.wait() App.get_instance( self.name).get_control_channel().new_request(self.data)
def run(self): # self.lock.wait(30) self.lock.clear() self.lock.wait() App.get_instance(self.name).get_control_channel().new_request( self.data)