Skip to content

Commit 042af4b

Browse files
author
Manik Sachdeva
authored
Merge branch 'master' into dev
2 parents f6b7419 + 2d8bad7 commit 042af4b

File tree

10 files changed

+133
-37
lines changed

10 files changed

+133
-37
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,59 @@ $opentok->dial($sessionId, $token, $sipUri, $options);
413413
For more information, see the [OpenTok SIP Interconnect developer
414414
guide](https://tokbox.com/developer/guides/sip/).
415415

416+
## Force Disconnect
417+
418+
Your application server can disconnect a client from an OpenTok session by calling the `forceDisconnect($sessionId, $connectionId)`
419+
method of the `OpenTok\OpenTok` class.
420+
421+
```php
422+
use OpenTok\OpenTok;
423+
424+
// Force disconnect a client connection
425+
$opentok->forceDisconnect($sessionId, $connectionId);
426+
```
427+
## Sending Signals
428+
429+
Once a Session is created, you can send signals to everyone in the session or to a specific connection.
430+
You can send a signal by calling the `signal($sessionId, $payload, $connectionId)` method of the
431+
`OpenTok\OpenTok` class.
432+
433+
The `$sessionId` parameter is the session ID of the session.
434+
435+
The `$payload` parameter is an associative array used to set the
436+
following:
437+
438+
* `data` (string) -- The data string for the signal. You can send a maximum of 8kB.
439+
440+
* `type` (string) -- — (Optional) The type string for the signal. You can send a maximum of 128 characters, and only the following characters are allowed: A-Z, a-z, numbers (0-9), '-', '_', and '~'.
441+
442+
The `$connectionId` parameter is an optional string used to specify the connection ID of
443+
a client connected to the session. If you specify this value, the signal is sent to
444+
the specified client. Otherwise, the signal is sent to all clients connected to the session.
445+
446+
447+
```php
448+
use OpenTok\OpenTok;
449+
450+
// Send a signal to a specific client
451+
$signalPayload = array(
452+
'data' => 'some signal message',
453+
'type' => 'signal type'
454+
);
455+
$connectionId = 'da9cb410-e29b-4c2d-ab9e-fe65bf83fcaf';
456+
$opentok->signal($sessionId, $signalPayload, $connectionId);
457+
458+
// Send a signal to everyone in the session
459+
$signalPayload = array(
460+
'data' => 'some signal message',
461+
'type' => 'signal type'
462+
);
463+
$opentok->signal($sessionId, $signalPayload);
464+
```
465+
466+
For more information, see the [OpenTok signaling developer
467+
guide](https://tokbox.com/developer/guides/signaling/).
468+
416469
## Samples
417470

418471
There are three sample applications included in this repository. To get going as fast as possible, clone the whole

src/OpenTok/Exception/ForceDisconnectConnectionException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class ForceDisconnectConnectionException extends \OpenTok\Exception\DomainException implements \OpenTok\Exception\ForceDisconnectException
1010
{
1111
/** @ignore */
12+
1213
public function __construct($message, $code)
1314
{
1415
parent::__construct($message, $code);

src/OpenTok/Exception/ForceDisconnectUnexpectedValueException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class ForceDisconnectUnexpectedValueException extends \OpenTok\Exception\UnexpectedValueException implements \OpenTok\Exception\ForceDisconnectException
1010
{
1111
/** @ignore */
12+
1213
public function __construct($message, $code)
1314
{
1415
parent::__construct($message, $code);

src/OpenTok/Exception/SignalConnectionException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class SignalConnectionException extends \OpenTok\Exception\DomainException implements \OpenTok\Exception\SignalException
1010
{
1111
/** @ignore */
12+
1213
public function __construct($message, $code)
1314
{
1415
parent::__construct($message, $code);

src/OpenTok/Exception/SignalUnexpectedValueException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class SignalUnexpectedValueException extends \OpenTok\Exception\UnexpectedValueException implements \OpenTok\Exception\SignalException
1010
{
1111
/** @ignore */
12+
1213
public function __construct($message, $code)
1314
{
1415
parent::__construct($message, $code);

src/OpenTok/OpenTok.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ public function updateStream($sessionId, $streamId, $properties = array())
634634
* Gets an Stream object, providing information on a given stream.
635635
*
636636
* @param String $sessionId The session ID for the OpenTok session containing the stream.
637-
*
637+
*
638638
* @param String $streamId The stream ID.
639639
*
640640
* @return Stream The Stream object.
@@ -652,14 +652,14 @@ public function getStream($sessionId, $streamId)
652652
}
653653

654654
/**
655-
* Returns a StreamList object for the given session.
655+
* Returns a StreamList Object for the given session ID.
656656
*
657657
* @param String $sessionId The session ID.
658658
*
659-
* @return StreamList A StreamList object. Call the
660-
* <a href="StreamList.html#method_getItems">OpenTok->getItems()</a> method of
661-
* the StreamList object to return an array of Stream objects.
659+
* @return StreamList A StreamList object. Call the items() method of the StreamList object
660+
* to return an array of Stream objects.
662661
*/
662+
663663
public function listStreams($sessionId)
664664
{
665665
Validators::validateSessionIdBelongsToKey($sessionId, $this->apiKey);

src/OpenTok/Stream.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@
2020
* @property String $videoType
2121
* The type of video in the stream, which is set to either "camera" or "screen".
2222
*/
23+
2324
class Stream {
2425

25-
/** @ignore */
2626
private $data;
2727

28-
/** @ignore */
2928
public function __construct($streamData)
3029
{
3130

src/OpenTok/Util/Client.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
// TODO: build this dynamically
4040
/** @internal */
41-
define('OPENTOK_SDK_VERSION', '4.1.2-alpha.1');
41+
define('OPENTOK_SDK_VERSION', '4.2.1-alpha.1');
4242
/** @internal */
4343
define('OPENTOK_SDK_USER_AGENT', 'OpenTok-PHP-SDK/' . OPENTOK_SDK_VERSION);
4444

@@ -462,6 +462,7 @@ public function setStreamClassLists($sessionId, $payload)
462462
}
463463
}
464464

465+
465466
public function dial($sessionId, $token, $sipUri, $options)
466467
{
467468
$body = array(

tests/OpenTok/ArchiveTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function testStopsArchive()
156156
// TODO: test the dynamically built User Agent string
157157
$userAgent = $request->getHeaderLine('User-Agent');
158158
$this->assertNotEmpty($userAgent);
159-
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.1.2-alpha.1', $userAgent);
159+
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.2.1-alpha.1', $userAgent);
160160

161161
// TODO: test the properties of the actual archive object
162162
$this->assertEquals('stopped', $this->archive->status);
@@ -195,7 +195,7 @@ public function testDeletesArchive()
195195
// TODO: test the dynamically built User Agent string
196196
$userAgent = $request->getHeaderLine('User-Agent');
197197
$this->assertNotEmpty($userAgent);
198-
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.1.2-alpha.1', $userAgent);
198+
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.2.1-alpha.1', $userAgent);
199199

200200
$this->assertTrue($success);
201201
// TODO: assert that all properties of the archive object were cleared

0 commit comments

Comments
 (0)