PHP 8.3.4 Released!

Stomp::__construct

stomp_connect

(PECL stomp >= 0.1.0)

Stomp::__construct -- stomp_connectOpens a connection

説明

オブジェクト指向型 (constructor):

public Stomp::__construct(
    string $broker = ini_get("stomp.default_broker_uri"),
    string $username = ?,
    string $password = ?,
    array $headers = ?
)

手続き型:

stomp_connect(
    string $broker = ini_get("stomp.default_broker_uri"),
    string $username = ?,
    string $password = ?,
    array $headers = ?
): resource

Opens a connection to a stomp compliant Message Broker.

パラメータ

broker

The broker URI

username

The username.

password

The password.

headers

追加のヘッダ (例: receipt) を含む連想配列。

戻り値

注意:

トランザクションヘッダを指定し、そのメッセージがトランザクションの一部であることを示します。

変更履歴

バージョン 説明
PECL stomp 1.0.1 The headers parameter was added

例1 オブジェクト指向型

<?php

/* connection */
try {
$stomp = new Stomp('tcp://localhost:61613');
} catch(
StompException $e) {
die(
'Connection failed: ' . $e->getMessage());
}

/* close connection */
unset($stomp);

?>

例2 手続き型

<?php

/* connection */
$link = stomp_connect('ssl://localhost:61612');

/* check connection */
if (!$link) {
die(
'Connection failed: ' . stomp_connect_error());
}

/* close connection */
stomp_close($link);

?>

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top