Итак, у меня есть следующий код:
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '../vendor/autoload.php'; // Loads the library
use Twilio\Jwt\TaskRouter\WorkerCapability;
// Your Account Sid and Auth Token from twilio.com/user/account
$accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$authToken = "your_auth_token";
$workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$capability = new WorkerCapability($accountSid, $authToken, $workspaceSid);
$capability->allowFetchSubresources();
$capability->allowActivityUpdates();
$capability->allowReservationUpdates();
$token = $capability->generateToken();
// By default, tokens are good for one hour.
// Override this default timeout by specifiying a new value (in seconds).
// For example, to generate a token good for 8 hours:
$token = $capability->generateToken(28800); // 60 * 60 * 8
?>
<script type="text/javascript" src="//media.twiliocdn.com/taskrouter/js/v1.20/taskrouter.min.js"></script>
<script>
var workspace = new Twilio.TaskRouter.Workspace("<?= $token ?>");
</script>
Код PHP генерирует токен нормально, но JS генерирует следующую ошибку:
WebSocket connection to '...' failed: Error during WebSocket handshake: Unexpected response code: 403
Любые идеи что с этим?
Спасибо!