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 HttpServer

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

Ratchet\Http\HttpServer implements Ratchet\MessageComponentInterface uses Ratchet\Http\CloseResponseTrait
Namespace: Ratchet\Http
Located at Ratchet/Http/HttpServer.php
Methods summary
public
# __construct( Ratchet\Http\HttpServerInterface $component )

Parameters

$component
Ratchet\Http\HttpServerInterface
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()
Properties summary
protected Ratchet\Http\HttpRequestParser $_reqParser
#

Buffers incoming HTTP requests returning a Guzzle Request when coalesced

Buffers incoming HTTP requests returning a Guzzle Request when coalesced

Note

May not expose this in the future, may do through facade methods
protected Ratchet\Http\HttpServerInterface $_httpServer
#
Ratchet API documentation generated by ApiGen 2.8.0