SAMConnection::error
SAMConnection::peek
SAM Functions
PHP Manual

# SAMConnection::isConnected

(PECL sam >= 0.1.0)

SAMConnection::isConnected — Queries whether a connection is established to a Messaging Server

### Description

bool SAMConnection::isConnected ( void )

Calling the "isConnected" method on a Connection object will check whether the PHP script is connected to a messaging server. No messages can be sent or received unless a connection has been established with a Messaging server.

### Return Values

This method returns `TRUE` if the SAMConnection object is successfully connected to a Messaging server or `FALSE` otherwise.

### Examples

Example #1 Checking whether there us a connection to a Messaging Server

`<?php
if ($conn->isConnected()) {
echo 'Connection is active.';
} else {
echo 'No active connection!';
}
?>`

### See Also

- SAMConnection::disconnect
- SAMConnection::connect

SAMConnection::error
SAMConnection::peek
SAM Functions
PHP Manual