Be careful, the lib does not send a DISCONNECT frame on destruction. Therefore the sessions will outlive the instance, accumulating in Artemis servers!
PHP.mk документација
Stomp::__destruct
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Патека
stomp.destruct.php
Локална патека за оваа страница.
Извор
php.net/manual/en
Оригиналниот HTML се реупотребува и локално се стилизира.
Режим
Прокси + превод во позадина
Кодовите, табелите и белешките остануваат читливи во истиот тек.
Референца
stomp.destruct.php
Stomp::__destruct
Референца за `stomp.destruct.php` со подобрена типографија и навигација.
Stomp::__destruct
stomp_close
(PECL stomp >= 0.1.0)
Stomp::__destruct -- stomp_close — Closes stomp connection
= NULL
Object-oriented style (destructor):
public Stomp::__destruct()
Објектно-ориентиран стил (метод):
Closes a previously opened connection.
Параметри
linkРегистрира слушање на дадена дестинација. stomp_connect().
Вратени вредности
Патеката до PHP скриптата што треба да се провери. true на успех или false при неуспех.
Примери
Константи за известување за грешки stomp_connect().
Белешки од корисници 2 забелешки
szasz dot attila at microsec dot hu ¶
пред 1 година
vanja at removethis dizyart period com ¶
пред 7 години
Isn't it a little odd to have connect/disconnect in the constructor/destructor methods?
I have a case where the connection is presumably kept alive until the PHP process ends:
<?php
class MyStompWrapper {
public function doSend()
{
$stomp = $this->connect(); // returns Stomp Object
$stomp->send('/destination', 'message', []);
$this->disconnect($stomp);
// $stomp still exists in this scope, hence, the connection is alive
}
private function disconnect(\Stomp $stompObj)
{
// only unsets the local $stomp pointer, does not actually disconnect
unset($stomp);
}
private function connect():\Stomp
{
// try-catch block omitted for example brevity
return new Stomp('url', 'username', 'password');
}
}
?>
This means that, in order to handle disconnecting, I have to create and destroy the Stomp object within the same scope.