I assume my problem is that each time the web page loads it creates a different session id and token.
I have this at the start of my basictutorial.php file
- Code: Select all
require_once 'opentok-php-sdk/API_Config.php';
require_once 'opentok-php-sdk/OpenTokSDK.php';
$apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
$session = $apiObj->create_session($_SERVER["REMOTE_ADDR"]);
$phpSessionVar = $session->getSessionId();
$phpTokenVar = $apiObj->generate_token();
//just echoing vars to see if they are different each time the page is loaded
echo $phpSessionVar;
echo '<br />';
echo '<br />';
echo $phpTokenVar;
Then the web page is just the basic tutorial with the production server js linked in the head and the following:
- Code: Select all
var sessionId = '<?=$phpSessionVar ?>'; // Replace with your session ID.
var token = '<?=$phpTokenVar ?>'; // Should not be hard-coded.
Can anyone tell me where I am going wrong? When I navigate to createSession.php (sample file in the php download). It displays a token and session id. And when I print the session id and token out to the screen from the basic tutorial page it displays them. But they are different every time I open the page on a different computer and the only cam showing is the one that pc.
Can anyone point me in the right direction? Thanks