Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
namespace Ratchet\RFC6455\Handshake;
3
use Psr\Http\Message\RequestInterface;
4
 
5
/**
6
 * A standard interface for interacting with the various version of the WebSocket protocol
7
 * @todo Look in to extension support
8
 */
9
interface NegotiatorInterface {
10
    const GUID = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
11
 
12
    /**
13
     * Given an HTTP header, determine if this version should handle the protocol
14
     * @param RequestInterface $request
15
     * @return bool
16
     */
17
    function isProtocol(RequestInterface $request);
18
 
19
    /**
20
     * Although the version has a name associated with it the integer returned is the proper identification
21
     * @return int
22
     */
23
    function getVersionNumber();
24
 
25
    /**
26
     * Perform the handshake and return the response headers
27
     * @param RequestInterface $request
28
     * @return \Psr\Http\Message\ResponseInterface
29
     */
30
    function handshake(RequestInterface $request);
31
 
32
    /**
33
     * Add supported protocols. If the request has any matching the response will include one
34
     * @param array $protocols
35
     */
36
    function setSupportedSubProtocols(array $protocols);
37
 
38
    /**
39
     * If enabled and support for a subprotocol has been added handshake
40
     *  will not upgrade if a match between request and supported subprotocols
41
     * @param boolean $enable
42
     * @todo Consider extending this interface and moving this there.
43
     *       The spec does says the server can fail for this reason, but
44
     *       it is not a requirement. This is an implementation detail.
45
     */
46
    function setStrictSubProtocolCheck($enable);
47
}