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
 1: <?php
 2: namespace Ratchet\Http;
 3: use Ratchet\ConnectionInterface;
 4: use GuzzleHttp\Psr7 as gPsr;
 5: use GuzzleHttp\Psr7\Response;
 6: 
 7: trait CloseResponseTrait {
 8:     /**
 9:      * Close a connection with an HTTP response
10:      * @param \Ratchet\ConnectionInterface $conn
11:      * @param int                          $code HTTP status code
12:      * @return null
13:      */
14:     private function close(ConnectionInterface $conn, $code = 400, array $additional_headers = []) {
15:         $response = new Response($code, array_merge([
16:             'X-Powered-By' => \Ratchet\VERSION
17:         ], $additional_headers));
18: 
19:         $conn->send(gPsr\str($response));
20:         $conn->close();
21:     }
22: }
Ratchet API documentation generated by ApiGen 2.8.0