(PECL stomp >= 0.1.0)
Stomp::__construct -- stomp_connect — Opens a connection
Stile orientato agli oggetti (constructor):
$broker
= ini_get("stomp.default_broker_uri"),$username
= ?,$password
= ?,$headers
= ?Stile procedurale:
$broker
= ini_get("stomp.default_broker_uri"),$username
= ?,$password
= ?,$headers
= ?Opens a connection to a stomp compliant Message Broker.
broker
The broker URI
username
The username.
password
The password.
headers
Array associativo che contiene le intestazioni addizionali (per esempio: receipt).
Nota:
Può essere definita un'intestazione di transazione, che indica che la conferma del messaggio deve essere parte della transazione specificata.
Versione | Descrizione |
---|---|
PECL stomp 1.0.1 |
The headers parameter was added
|
Example #1 Stile orientato agli oggetti
<?php
/* connection */
try {
$stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
die('Connection failed: ' . $e->getMessage());
}
/* close connection */
unset($stomp);
?>
Example #2 Stile procedurale
<?php
/* connection */
$link = stomp_connect('ssl://localhost:61612');
/* check connection */
if (!$link) {
die('Connection failed: ' . stomp_connect_error());
}
/* close connection */
stomp_close($link);
?>
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant