Stomp Client Stomp::__construct
stomp_connect
(PECL stomp >= 0.1.0)
Stomp::__construct -- stomp_connect — 연결을 엽니다.
설명
객체 지향 스타일(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
스톰프 호환 메시지 브로커에 대한 연결을 엽니다.
매개변수
broker
- 브로커 URI
username
- 사용자 이름.
password
- 비밀번호.
headers
- 추가 헤더를 포함하는 연관 배열(예: receipt).
반환 값
메모: 메시지 승인이 명명된 트랜잭션의 일부여야 함을 나타내는 트랜잭션 헤더가 지정될 수 있습니다.
변경 로그
버전 | 설명 |
---|---|
PECL stomp 1.0.1 | headers 매개변수가 추가되었습니다. |
Examples
예제 #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);
?>