1 | <?php |
||
25 | class AsyncSocketFactory |
||
26 | { |
||
27 | /** |
||
28 | * Create client socket |
||
29 | */ |
||
30 | const SOCKET_CLIENT = 'client'; |
||
31 | |||
32 | /** |
||
33 | * Create server socket |
||
34 | */ |
||
35 | const SOCKET_SERVER = 'server'; |
||
36 | |||
37 | /** |
||
38 | * Boolean flag whether it is persistent socket, applicable only for SOCKET_CLIENT type |
||
39 | */ |
||
40 | const SOCKET_OPTION_IS_PERSISTENT = 'soIsPersistent'; |
||
41 | |||
42 | /** |
||
43 | * Key in php storage to allow multiple persistent connections to the same host [a-zA-Z0-9_-] |
||
44 | */ |
||
45 | const SOCKET_OPTION_PERSISTENT_KEY = 'soPersistentKey'; |
||
46 | |||
47 | /** |
||
48 | * Default configuration for this factory |
||
49 | * |
||
50 | * @var Configuration |
||
51 | */ |
||
52 | private $configuration; |
||
53 | |||
54 | /** |
||
55 | * AsyncSocketFactory constructor. |
||
56 | * |
||
57 | * @param Configuration $configuration Default configuration for this factory |
||
58 | */ |
||
59 | 7 | public function __construct(Configuration $configuration = null) |
|
63 | |||
64 | /** |
||
65 | * Create socket client |
||
66 | * |
||
67 | * @param string $type Socket type to create, one of SOCKET_* consts |
||
68 | * @param array $options $flags Flags with socket settings, see SOCKET_OPTION_* consts |
||
69 | * |
||
70 | * @return SocketInterface |
||
71 | * @api |
||
72 | */ |
||
73 | 4 | public function createSocket($type = self::SOCKET_CLIENT, array $options = []) |
|
92 | |||
93 | /** |
||
94 | * Create RequestExecutor object |
||
95 | * |
||
96 | * @return RequestExecutorInterface |
||
97 | * |
||
98 | * @api |
||
99 | */ |
||
100 | 3 | public function createRequestExecutor() |
|
123 | } |
||
124 |