Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit620fe08

Browse files
committed
Add SWOOLE_SSL
1 parentc1f261e commit620fe08

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

‎src/Command/PublishCommand.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ protected function configure()
4747
newInputOption('will-message','wm', InputOption::VALUE_OPTIONAL,'Specify a message that will be stored by the broker and sent out if this client disconnects unexpectedly'),
4848
newInputOption('will-qos','wq', InputOption::VALUE_OPTIONAL,'The QoS to use for the Will',0),
4949
newInputOption('will-retain','wr', InputOption::VALUE_OPTIONAL,'If given, if the client disconnects unexpectedly the message sent out will be treated as a retained message',0),
50+
newInputOption('ssl','S', InputOption::VALUE_OPTIONAL,'Enable SSL encryption',false),
5051
])
5152
);
5253
}

‎src/Handler/AbstractHandler.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ public function getCleanSession(): bool
7373
return (bool)$this->input->getOption('clean-session');
7474
}
7575

76+
publicfunctiongetSSL():bool
77+
{
78+
return (bool)$this->input->getOption('ssl');
79+
}
80+
81+
publicfunctiongetSocketType():int
82+
{
83+
if ($this->getSSL()) {
84+
returnSWOOLE_SOCK_TCP |SWOOLE_SSL;
85+
}
86+
87+
returnSWOOLE_SOCK_TCP;
88+
}
89+
7690
publicfunctiongetKeepAlive():int
7791
{
7892
return (int)$this->input->getOption('keepalive');
@@ -133,6 +147,7 @@ public function getConnectConfig(): ClientConfig
133147
->setKeepAlive($this->getKeepAlive())
134148
->setProtocolName($this->getProtocolName())
135149
->setProtocolLevel($this->getProtocolLevel())
150+
->setSockType($this->getSocketType())
136151
->setMaxAttempts(0);// Disable auto reconnection
137152
}
138153

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp