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

  • HttpRequestParser
  • HttpServer
  • OriginCheck
  • Router

Interfaces

  • HttpServerInterface

Traits

  • CloseResponseTrait
  • Overview
  • Namespace
  • Class
  • Tree

Class Router

This is the interface to build a Ratchet application with. It implements the decorator pattern to build an application stack

Ratchet\Http\Router implements Ratchet\Http\HttpServerInterface uses Ratchet\Http\CloseResponseTrait
Namespace: Ratchet\Http
Located at Ratchet/Http/Router.php
Methods summary
public
# __construct( Symfony\Component\Routing\Matcher\UrlMatcherInterface $matcher )
public
# onOpen( Ratchet\ConnectionInterface $conn, Psr\Http\Message\RequestInterface $request = null )

Parameters

$conn
Ratchet\ConnectionInterface
$conn
$request
Psr\Http\Message\RequestInterface
$request null is default because PHP won't let me overload; don't pass null!!!

Throws

UnexpectedValueException
If a controller is not \Ratchet\Http\HttpServerInterface

Implementation of

Ratchet\Http\HttpServerInterface::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()
Properties summary
protected Symfony\Component\Routing\Matcher\UrlMatcherInterface $_matcher
#
Ratchet API documentation generated by ApiGen 2.8.0