crossbar.webservice.flashpolicy¶
Classes¶
This is a factory which produces protocols. |
|
Flash Player 9 (version 9.0.124.0 and above) implements a strict new access |
Module Contents¶
- class FlashPolicyFactory(allowedDomain=None, allowedPorts=None, reactor=None)[source]¶
Bases:
twisted.internet.protocol.FactoryThis is a factory which produces protocols.
By default, buildProtocol will create a protocol of the class given in self.protocol.
- buildProtocol(addr)[source]¶
Create an instance of a subclass of Protocol.
The returned instance will handle input on an incoming server connection, and an attribute “factory” pointing to the creating factory.
Alternatively, L{None} may be returned to immediately close the new connection.
Override this method to alter how Protocol instances get created.
@param addr: an object implementing L{IAddress}
- class FlashPolicyProtocol(allowedDomain, allowedPorts)[source]¶
Bases:
twisted.internet.protocol.ProtocolFlash Player 9 (version 9.0.124.0 and above) implements a strict new access policy for Flash applications that make Socket or XMLSocket connections to a remote host. It now requires the presence of a socket policy file on the server.
We want this to support the Flash WebSockets bridge which is needed for older browser, in particular MSIE9/8.
See also
- POLICYFILE = '<?xml version="1.0"?><cross-domain-policy><allow-access-from domain="%s" to-ports="%s"...[source]¶
- connectionLost(reason)[source]¶
Called when the connection is shut down.
Clear any circular references here, and any external references to this Protocol. The connection has been closed.
@type reason: L{twisted.python.failure.Failure}
- connectionMade()[source]¶
Called when a connection is made.
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
- dataReceived(data)[source]¶
Called whenever data is received.
Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.
- @param data: a string of indeterminate length. Please keep in mind
that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.