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

  • Connector
  • DnsConnector
  • LimitingServer
  • SecureConnector
  • SecureServer
  • Server
  • TcpConnector
  • TimeoutConnector
  • UnixConnector

Interfaces

  • ConnectionInterface
  • ConnectorInterface
  • ServerInterface
  • Overview
  • Namespace
  • Class
  • Tree

Class Connector

The Connector class is the main class in this package that implements the ConnectorInterface and allows you to create streaming connections.

You can use this connector to create any kind of streaming connections, such as plaintext TCP/IP, secure TLS or local Unix connection streams.

Under the hood, the Connector is implemented as a higher-level facade or the lower-level connectors implemented in this package. This means it also shares all of their features and implementation details. If you want to typehint in your higher-level protocol implementation, you SHOULD use the generic [ConnectorInterface](#connectorinterface) instead.

React\Socket\Connector implements React\Socket\ConnectorInterface
Final
Namespace: React\Socket
See: ConnectorInterface for the base interface
Located at Connector.php
Methods summary
public
# __construct( React\EventLoop\LoopInterface $loop, array $options = array() )
public React\Promise\PromiseInterface
# connect( string $uri )

Creates a streaming connection to the given remote address

Creates a streaming connection to the given remote address

If returns a Promise which either fulfills with a stream implementing ConnectionInterface on success or rejects with an Exception if the connection is not successful.

`php $connector->connect('google.com:443')->then( function (ConnectionInterface $connection) { // connection successfully established }, function (Exception $error) { // failed to connect due to $error } ); `

The returned Promise MUST be implemented in such a way that it can be cancelled when it is still pending. Cancelling a pending promise MUST reject its value with an Exception. It SHOULD clean up any underlying resources and references as applicable.

`php $promise = $connector->connect($uri);

$promise->cancel(); `

Parameters

$uri
string
$uri

Returns

React\Promise\PromiseInterface
resolves with a stream implementing ConnectionInterface on success or rejects with an Exception on error

See

React\Socket\ConnectionInterface

Implementation of

React\Socket\ConnectorInterface::connect()
Ratchet API documentation generated by ApiGen 2.8.0