OLD | NEW |
| (Empty) |
1 from twisted.internet.protocol import Factory | |
2 from twisted.protocols.basic import LineReceiver | |
3 from twisted.python import log | |
4 from twisted.web.woven import interfaces | |
5 | |
6 | |
7 class FlashConduit(LineReceiver): | |
8 delimiter = '\0' | |
9 keepalive = 1 | |
10 def connectionMade(self): | |
11 print "connection with flash movie opened" | |
12 #self.transport.write("alert('helllllllo')\0") | |
13 | |
14 def connectionLost(self, reason): | |
15 print "connection lost" | |
16 #self.lp.unhookOutputConduit() | |
17 | |
18 def lineReceived(self, line): | |
19 session = self.factory.site.getSession(line) | |
20 self.lp = lp = session.getComponent(interfaces.IWovenLivePage) | |
21 lp.hookupOutputConduit(self) | |
22 | |
23 def writeScript(self, data): | |
24 #print "writing javascript", data | |
25 self.transport.write(data + '\0') | |
26 | |
27 def finish(self): | |
28 pass | |
29 | |
30 | |
31 class FlashConduitFactory(Factory): | |
32 protocol = FlashConduit | |
33 | |
34 def __init__(self, site): | |
35 self.site = site | |
OLD | NEW |