Esempio n. 1
0
 def websocket_handler(self, ws):
     pathlist = filter(lambda x: bool(x), ws.path.split("/"))
     
     session = pathlist[0]
     sm = self.sm_mapping.get(session) or self.init_session(session)
     if not session in self.clients: 
         self.clients[session] = [ws]
         eventlet.spawn(self.websocket_response, sm, session)
     else:
         self.clients[session].append(ws)
     sm.send("websocket.connect")
     while True:
         message = ws.wait()
         if message is None:
             break
         evt = Processor.fromxml(str(message), origintype="javascript")
         sm.interpreter.externalQueue.put(evt)
     sm.send("websocket.disconnect")
     self.clients[session].remove(ws)
Esempio n. 2
0
    def websocket_handler(self, ws):
        pathlist = filter(lambda x: bool(x), ws.path.split("/"))

        session = pathlist[0]
        sm = self.sm_mapping.get(session) or self.init_session(session)
        if not session in self.clients:
            self.clients[session] = [ws]
            eventlet.spawn(self.websocket_response, sm, session)
        else:
            self.clients[session].append(ws)
        sm.send("websocket.connect")
        while True:
            message = ws.wait()
            if message is None:
                break
            evt = Processor.fromxml(str(message), origintype="javascript")
            sm.interpreter.externalQueue.put(evt)
        sm.send("websocket.disconnect")
        self.clients[session].remove(ws)
Esempio n. 3
0
def type_scxml(session, data, sm, environ):
    event = Processor.fromxml(data)
    event.type = "HTTP"
    return event
Esempio n. 4
0
def type_scxml(session, data, sm, environ, raw=None):
    event = Processor.fromxml(data)
    event.type = "HTTP"

    return event