Stomp::getSessionId

stomp_get_session_id

Gets the current stomp session ID

&reftitle.description;

&style.oop; (method):

public ``string``false```Stomp::getSessionId`

&style.procedural;:

``string``false```stomp_get_session_id` `resource` `link`

Gets the current stomp session ID.

&reftitle.parameters;

&stomp.param.link;
&reftitle.returnvalues;

&string; session id on success&return.falseforfailure;.

&reftitle.examples;

### &style.oop;

    <?php

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

    var_dump($stomp->getSessionId());

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

    ?>

&example.outputs.similar;

    string(35) "ID:php.net-52873-1257291895530-4:14"

### &style.procedural;

    <?php

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

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

    var_dump(stomp_get_session_id($link));

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

    ?>

&example.outputs.similar;

    string(35) "ID:php.net-52873-1257291895530-4:14"