Skip to content

Commit 544c57e

Browse files
author
dstevenson
authored
Merge pull request #17 from centraldesktop/bugfix/issue-16
bugfix() Addresses https://bugs.php.net/bug.php?id=74216 where you
2 parents 45a2fa0 + b9e7cef commit 544c57e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/CentralDesktop/Stomp/Connection.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,14 @@ function _makeConnection() {
139139
$host = $url['host'];
140140

141141
$this->connectedHost = $host;
142-
$this->_socket = @fsockopen($brokerUri, $port, $connect_errno, $connect_errstr, $this->_connect_timeout_seconds);
142+
143+
$hostname = $host;
144+
if (array_key_exists('scheme', $url)) {
145+
$hostname = "{$url['scheme']}://$host";
146+
}
147+
$this->_socket = @fsockopen($hostname, $port, $connect_errno, $connect_errstr, $this->_connect_timeout_seconds);
143148
if (!is_resource($this->_socket) && $att >= $this->_attempts) {
144-
throw new Exception("Could not connect to $host:$port ($att/{$this->_attempts})");
149+
throw new Exception("Could not connect to $hostname:$port ($att/{$this->_attempts})");
145150
}
146151
elseif (is_resource($this->_socket)) {
147152
$connected = true;

0 commit comments

Comments
 (0)