Overview

Namespaces

  • Evenement
  • None
  • PHP
  • Psr
    • Http
      • Message
  • Ratchet
    • Http
    • RFC6455
      • Handshake
      • Messaging
    • Server
    • Session
      • Serialize
      • Storage
        • Proxy
    • Wamp
    • WebSocket
  • React
    • EventLoop
      • Tick
      • Timer
    • Socket
    • Stream
  • Symfony
    • Component
      • HttpFoundation
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
      • Routing
        • Annotation
        • Exception
        • Generator
          • Dumper
        • Loader
          • DependencyInjection
        • Matcher
          • Dumper
        • Tests
          • Annotation
          • Fixtures
            • AnnotatedClasses
            • OtherAnnotatedClasses
          • Generator
            • Dumper
          • Loader
          • Matcher
            • Dumper

Classes

  • EchoServer
  • FlashPolicy
  • IoConnection
  • IoServer
  • IpBlackList
  • Overview
  • Namespace
  • Class
  • Tree

Class FlashPolicy

An app to go on a server stack to pass a policy file to a Flash socket Useful if you're using Flash as a WebSocket polyfill on IE Be sure to run your server instance on port 843 By default this lets accepts everything, make sure you tighten the rules up for production

Ratchet\Server\FlashPolicy implements Ratchet\MessageComponentInterface
Namespace: Ratchet\Server
Link: http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html
Link: http://learn.adobe.com/wiki/download/attachments/64389123/CrossDomain_PolicyFile_Specification.pdf?version=1
Link: view-source:http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd
Located at Ratchet/Server/FlashPolicy.php
Methods summary
public Ratchet\Server\FlashPolicy
# addAllowedAccess( string $domain, string $ports = '*', boolean $secure = false )

Add a domain to an allowed access list.

Add a domain to an allowed access list.

Parameters

$domain
string
$domain Specifies a requesting domain to be granted access. Both named domains and IP addresses are acceptable values. Subdomains are considered different domains. A wildcard (*) can be used to match all domains when used alone, or multiple domains (subdomains) when used as a prefix for an explicit, second-level domain name separated with a dot (.)
$ports
string
$ports A comma-separated list of ports or range of ports that a socket connection is allowed to connect to. A range of ports is specified through a dash (-) between two port numbers. Ranges can be used with individual ports when separated with a comma. A single wildcard (*) can be used to allow all ports.
$secure
boolean
$secure

Returns

Ratchet\Server\FlashPolicy

Throws

UnexpectedValueException
public Ratchet\Server\FlashPolicy
# clearAllowedAccess( )

Removes all domains from the allowed access list.

Removes all domains from the allowed access list.

Returns

Ratchet\Server\FlashPolicy
public Ratchet\Server\FlashPolicy
# setSiteControl( string $permittedCrossDomainPolicies = 'all' )

site-control defines the meta-policy for the current domain. A meta-policy specifies acceptable domain policy files other than the master policy file located in the target domain's root and named crossdomain.xml.

site-control defines the meta-policy for the current domain. A meta-policy specifies acceptable domain policy files other than the master policy file located in the target domain's root and named crossdomain.xml.

Parameters

$permittedCrossDomainPolicies
string
$permittedCrossDomainPolicies

Returns

Ratchet\Server\FlashPolicy

Throws

UnexpectedValueException
public
# onOpen( Ratchet\ConnectionInterface $conn )

When a new connection is opened it will be passed to this method

When a new connection is opened it will be passed to this method

Parameters

$conn
Ratchet\ConnectionInterface
$conn The socket/connection that just connected to your application

Throws

Exception

Implementation of

Ratchet\ComponentInterface::onOpen()
public
# onMessage( Ratchet\ConnectionInterface $from, string $msg )

Triggered when a client sends data through the socket

Triggered when a client sends data through the socket

Parameters

$from
Ratchet\ConnectionInterface
$from The socket/connection that sent the message to your application
$msg
string
$msg The message received

Throws

Exception

Implementation of

Ratchet\MessageInterface::onMessage()
public
# onClose( Ratchet\ConnectionInterface $conn )

This is called before or after a socket is closed (depends on how it's closed). SendMessage to $conn will not result in an error if it has already been closed.

This is called before or after a socket is closed (depends on how it's closed). SendMessage to $conn will not result in an error if it has already been closed.

Parameters

$conn
Ratchet\ConnectionInterface
$conn The socket/connection that is closing/closed

Throws

Exception

Implementation of

Ratchet\ComponentInterface::onClose()
public
# onError( Ratchet\ConnectionInterface $conn, Exception $e )

If there is an error with one of the sockets, or somewhere in the application where an Exception is thrown, the Exception is sent back down the stack, handled by the Server and bubbled back up the application through this method

If there is an error with one of the sockets, or somewhere in the application where an Exception is thrown, the Exception is sent back down the stack, handled by the Server and bubbled back up the application through this method

Parameters

$conn
Ratchet\ConnectionInterface
$conn
$e
Exception
$e

Throws

Exception

Implementation of

Ratchet\ComponentInterface::onError()
public SimpleXMLElement
# renderPolicy( )

Builds the crossdomain file based on the template policy

Builds the crossdomain file based on the template policy

Returns

SimpleXMLElement

Throws

UnexpectedValueException
public boolean
# validateSiteControl( string $permittedCrossDomainPolicies )

Make sure the proper site control was passed

Make sure the proper site control was passed

Parameters

$permittedCrossDomainPolicies
string
$permittedCrossDomainPolicies

Returns

boolean
public boolean
# validateDomain( string $domain )

Validate for proper domains (wildcards allowed)

Validate for proper domains (wildcards allowed)

Parameters

$domain
string
$domain

Returns

boolean
public boolean
# validatePorts( string $port )

Make sure valid ports were passed

Make sure valid ports were passed

Parameters

$port
string
$port

Returns

boolean
Properties summary
protected string $_policy '<?xml version="1.0"?><!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"><cross-domain-policy></cross-domain-policy>'
#

Contains the root policy node

Contains the root policy node

protected array $_access array()
#

Stores an array of allowed domains and their ports

Stores an array of allowed domains and their ports

protected string $_siteControl ''
#
protected string $_cache ''
#
protected string $_cacheValid false
#
Ratchet API documentation generated by ApiGen 2.8.0