-
Notifications
You must be signed in to change notification settings - Fork 42
/
SocketEventInterface.php
70 lines (58 loc) · 1.61 KB
/
SocketEventInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/*
* This file is part of Icicle, a library for writing asynchronous code in PHP using promises and coroutines.
*
* @copyright 2014-2015 Aaron Piotrowski. All rights reserved.
* @license Apache-2.0 See the LICENSE file that was distributed with this source code for more information.
*/
namespace Icicle\Loop\Events;
interface SocketEventInterface
{
/**
* Returns the PHP resource.
*
* @return resource
*/
public function getResource();
/**
* @param bool $expired
*/
public function call($expired);
/**
* @param bool $expired
*/
public function __invoke($expired);
/**
* @param callable $callback
*/
public function setCallback(callable $callback);
/**
* Listens for data or the ability to write.
*
* @param int|float $timeout Number of seconds until the callback is invoked with $expired set to true if
* no data is received or the socket does not become writable. Use null for no timeout.
*/
public function listen($timeout = 0);
/**
* Stops listening for data or the ability to write on the socket.
*/
public function cancel();
/**
* Determines if the socket event is currently listening for data or the ability to write.
*
* @return bool
*/
public function isPending();
/**
* Frees the resources used to listen for events on the socket.
*/
public function free();
/**
* @return bool
*/
public function isFreed();
/**
* @return \Icicle\Loop\LoopInterface
*/
public function getLoop();
}