File tree 3 files changed +12
-13
lines changed
3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 16
16
],
17
17
"require" : {
18
18
"php" : " >=8.1" ,
19
- "guzzlehttp/psr7" : " ^2.0"
19
+ "guzzlehttp/psr7" : " ^2.0" ,
20
+ "ahmard/http-status-codes" : " ^1.0"
20
21
},
21
22
"scripts" : {
22
23
"analyse" : " phpstan analyse" ,
Original file line number Diff line number Diff line change 2
2
3
3
namespace RTC \Contracts \Websocket ;
4
4
5
+ use HttpStatusCodes \StatusCode ;
5
6
use RTC \Contracts \Enums \WSSenderType ;
6
7
7
8
interface ConnectionInterface
@@ -16,8 +17,7 @@ public function __construct(int $fd);
16
17
* @param array $meta
17
18
* @param WSSenderType $senderType
18
19
* @param string $senderId
19
- * @param int $status
20
- * @param string $statusText
20
+ * @param StatusCode $status
21
21
* @param int $opcode
22
22
* @param int $flags
23
23
* @return void
@@ -28,8 +28,7 @@ public function send(
28
28
array $ meta = [],
29
29
WSSenderType $ senderType = WSSenderType::SERVER ,
30
30
string $ senderId = 'system ' ,
31
- int $ status = 200 ,
32
- string $ statusText = 'success ' ,
31
+ StatusCode $ status = StatusCode::OK ,
33
32
int $ opcode = 1 ,
34
33
int $ flags = SWOOLE_WEBSOCKET_FLAG_FIN
35
34
): void ;
Original file line number Diff line number Diff line change 2
2
3
3
namespace RTC \Contracts \Websocket ;
4
4
5
+ use HttpStatusCodes \StatusCode ;
5
6
use RTC \Contracts \Server \ServerInterface ;
6
7
use Swoole \Table ;
7
8
@@ -69,19 +70,17 @@ public function getMetaData(int|ConnectionInterface $connection): ?array;
69
70
/**
70
71
* @param string $event
71
72
* @param mixed $message
72
- * @param int $status
73
- * @param string $statusText
74
73
* @param array $meta
75
74
* @param array $excludeIds
75
+ * @param StatusCode $status
76
76
* @return int
77
77
*/
78
78
public function send (
79
- string $ event ,
80
- mixed $ message ,
81
- int $ status = 200 ,
82
- string $ statusText = 'success ' ,
83
- array $ meta = [],
84
- array $ excludeIds = []
79
+ string $ event ,
80
+ mixed $ message ,
81
+ array $ meta = [],
82
+ array $ excludeIds = [],
83
+ StatusCode $ status = StatusCode::OK ,
85
84
): int ;
86
85
87
86
/**
You can’t perform that action at this time.
0 commit comments