Skip to content

Commit

Permalink
Revert "MessagingSession reconnects with refreshed endpoint and crede…
Browse files Browse the repository at this point in the history
…ntials if needed (#2180)"

This reverts commit e47bbbd.
  • Loading branch information
devalevenkatesh committed Apr 27, 2022
1 parent 0f0ea25 commit 7c3f964
Show file tree
Hide file tree
Showing 11 changed files with 3,540 additions and 5,660 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- `MessagingSession` reconnects with refreshed endpoint and credentials if needed. EndpointUrl on `MessagingSessionConfiguration` is deprecated as it is resolved by calling `getMessagingSessionEndpoint` internally.
- Fix a bug that `remote-inbound-rtp` `RTCStatsReport` and `remote-outbound-rtp` `RTCStatsReport` of "video" `kind` are accidentally filtered.
- Fix the incorrect calculation of aggregation WebRTC metric spec (`audioSpeakerDelayMs`, `decoderLoss`).

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ The value of the MediaRegion parameter in the createMeeting() should ideally be
Create a messaging session in your client application to receive messages from Amazon Chime SDK for Messaging.

```js
import { ChimeSDKMessagingClient } from '@aws-sdk/client-chime-sdk-messaging';
import { ChimeSDKMessagingClient, GetMessagingSessionEndpointCommand } from '@aws-sdk/client-chime-sdk-messaging';

import {
ConsoleLogger,
Expand All @@ -243,10 +243,11 @@ const logger = new ConsoleLogger('SDK', LogLevel.INFO);

// You will need AWS credentials configured before calling AWS or Amazon Chime APIs.
const chime = new ChimeSDKMessagingClient({ region: 'us-east-1'});
const endpoint = await chime.send(new GetMessagingSessionEndpointCommand());

const userArn = /* The userArn */;
const sessionId = /* The sessionId */;
const configuration = new MessagingSessionConfiguration(userArn, sessionId, undefined, chime);
const configuration = new MessagingSessionConfiguration(userArn, sessionId, endpoint.Endpoint.Url, chime);
const messagingSession = new DefaultMessagingSession(configuration, logger);
```

Expand Down
5 changes: 3 additions & 2 deletions demos/browser/app/messagingSession/messagingSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
Versioning,
} from 'amazon-chime-sdk-js';

import { ChimeSDKMessagingClient } from '@aws-sdk/client-chime-sdk-messaging';
import { ChimeSDKMessagingClient, GetMessagingSessionEndpointCommand } from '@aws-sdk/client-chime-sdk-messaging';

export class DemoMessagingSessionApp implements MessagingSessionObserver {
static readonly BASE_URL: string = [
Expand Down Expand Up @@ -54,9 +54,10 @@ export class DemoMessagingSessionApp implements MessagingSessionObserver {
try {
const response = await this.fetchCredentials();
const chime = new ChimeSDKMessagingClient({ region: 'us-east-1', credentials: response });
const endpoint = await chime.send(new GetMessagingSessionEndpointCommand());
this.userArn = (document.getElementById('userArn') as HTMLInputElement).value;
this.sessionId = (document.getElementById('sessionId') as HTMLInputElement).value;
this.configuration = new MessagingSessionConfiguration(this.userArn, this.sessionId, undefined, chime);
this.configuration = new MessagingSessionConfiguration(this.userArn, this.sessionId, endpoint.Endpoint.Url, chime);
this.session = new DefaultMessagingSession(this.configuration, this.logger);
this.session.addObserver(this);
this.session.start();
Expand Down
12 changes: 6 additions & 6 deletions docs/classes/defaultmessagingsession.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L25">src/messagingsession/DefaultMessagingSession.ts:25</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L23">src/messagingsession/DefaultMessagingSession.ts:23</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -154,7 +154,7 @@ <h3>add<wbr>Observer</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/messagingsession.html">MessagingSession</a>.<a href="../interfaces/messagingsession.html#addobserver">addObserver</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L55">src/messagingsession/DefaultMessagingSession.ts:55</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L53">src/messagingsession/DefaultMessagingSession.ts:53</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -177,7 +177,7 @@ <h3>for<wbr>Each<wbr>Observer</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L83">src/messagingsession/DefaultMessagingSession.ts:83</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L81">src/messagingsession/DefaultMessagingSession.ts:81</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -219,7 +219,7 @@ <h3>remove<wbr>Observer</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/messagingsession.html">MessagingSession</a>.<a href="../interfaces/messagingsession.html#removeobserver">removeObserver</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L60">src/messagingsession/DefaultMessagingSession.ts:60</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L58">src/messagingsession/DefaultMessagingSession.ts:58</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -243,7 +243,7 @@ <h3>start</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/messagingsession.html">MessagingSession</a>.<a href="../interfaces/messagingsession.html#start">start</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L65">src/messagingsession/DefaultMessagingSession.ts:65</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L63">src/messagingsession/DefaultMessagingSession.ts:63</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -261,7 +261,7 @@ <h3>stop</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/messagingsession.html">MessagingSession</a>.<a href="../interfaces/messagingsession.html#stop">stop</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L73">src/messagingsession/DefaultMessagingSession.ts:73</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/DefaultMessagingSession.ts#L71">src/messagingsession/DefaultMessagingSession.ts:71</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
Expand Down
22 changes: 10 additions & 12 deletions docs/classes/messagingsessionconfiguration.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h2>Constructors</h2>
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>Messaging<wbr>Session<wbr>Configuration<span class="tsd-signature-symbol">(</span>userArn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, messagingSessionId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span>, endpointUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span>, chimeClient<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="messagingsessionconfiguration.html" class="tsd-signature-type">MessagingSessionConfiguration</a></li>
<li class="tsd-signature tsd-kind-icon">new <wbr>Messaging<wbr>Session<wbr>Configuration<span class="tsd-signature-symbol">(</span>userArn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, messagingSessionId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span>, endpointUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, chimeClient<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="messagingsessionconfiguration.html" class="tsd-signature-type">MessagingSessionConfiguration</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
Expand All @@ -126,12 +126,10 @@ <h3>constructor</h3>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Constructs a MessagingSessionConfiguration optionally with userArn, messaging session id, a messaging session
endpoint URL, and the chimeClient.</p>
endpoint URL, and the chimeClient.
The messaging session id is to uniquely identify this messaging session for the userArn.
If messaging session id is passed in as null, it will be automatically generated.</p>
</div>
<p>endpointUrl is deprecated and should not be used. Internally it is resolved on connect via chimeClient if undefined, and
always re-resolved on reconnect.</p>
<p>The messaging session id is to uniquely identify this messaging session for the userArn.
If messaging session id is passed in as null, it will be automatically generated.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
Expand All @@ -142,7 +140,7 @@ <h5>userArn: <span class="tsd-signature-type">string</span></h5>
<h5>messagingSessionId: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></h5>
</li>
<li>
<h5>endpointUrl: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span></h5>
<h5>endpointUrl: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>chimeClient: <span class="tsd-signature-type">any</span></h5>
Expand All @@ -161,17 +159,17 @@ <h3>chime<wbr>Client</h3>
<div class="tsd-signature tsd-kind-icon">chime<wbr>Client<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/MessagingSessionConfiguration.ts#L44">src/messagingsession/MessagingSessionConfiguration.ts:44</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/MessagingSessionConfiguration.ts#L40">src/messagingsession/MessagingSessionConfiguration.ts:40</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="endpointurl" class="tsd-anchor"></a>
<h3>endpoint<wbr>Url</h3>
<div class="tsd-signature tsd-kind-icon">endpoint<wbr>Url<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span></div>
<div class="tsd-signature tsd-kind-icon">endpoint<wbr>Url<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/MessagingSessionConfiguration.ts#L43">src/messagingsession/MessagingSessionConfiguration.ts:43</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/MessagingSessionConfiguration.ts#L39">src/messagingsession/MessagingSessionConfiguration.ts:39</a></li>
</ul>
</aside>
</section>
Expand All @@ -181,7 +179,7 @@ <h3>messaging<wbr>Session<wbr>Id</h3>
<div class="tsd-signature tsd-kind-icon">messaging<wbr>Session<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/MessagingSessionConfiguration.ts#L42">src/messagingsession/MessagingSessionConfiguration.ts:42</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/MessagingSessionConfiguration.ts#L38">src/messagingsession/MessagingSessionConfiguration.ts:38</a></li>
</ul>
</aside>
</section>
Expand Down Expand Up @@ -251,7 +249,7 @@ <h3>user<wbr>Arn</h3>
<div class="tsd-signature tsd-kind-icon">user<wbr>Arn<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/MessagingSessionConfiguration.ts#L41">src/messagingsession/MessagingSessionConfiguration.ts:41</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/messagingsession/MessagingSessionConfiguration.ts#L37">src/messagingsession/MessagingSessionConfiguration.ts:37</a></li>
</ul>
</aside>
</section>
Expand Down
5 changes: 3 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ <h4>Getting responses from your server application</h4>
<h3>Messaging session</h3>
</a>
<p>Create a messaging session in your client application to receive messages from Amazon Chime SDK for Messaging.</p>
<pre><code class="language-js"><span class="hljs-keyword">import</span> { ChimeSDKMessagingClient } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@aws-sdk/client-chime-sdk-messaging&#x27;</span>;
<pre><code class="language-js"><span class="hljs-keyword">import</span> { ChimeSDKMessagingClient, GetMessagingSessionEndpointCommand } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@aws-sdk/client-chime-sdk-messaging&#x27;</span>;

<span class="hljs-keyword">import</span> {
ConsoleLogger,
Expand All @@ -316,10 +316,11 @@ <h3>Messaging session</h3>

<span class="hljs-comment">// You will need AWS credentials configured before calling AWS or Amazon Chime APIs.</span>
<span class="hljs-keyword">const</span> chime = <span class="hljs-keyword">new</span> ChimeSDKMessagingClient({ <span class="hljs-attr">region</span>: <span class="hljs-string">&#x27;us-east-1&#x27;</span>});
<span class="hljs-keyword">const</span> endpoint = <span class="hljs-keyword">await</span> chime.send(<span class="hljs-keyword">new</span> GetMessagingSessionEndpointCommand());

<span class="hljs-keyword">const</span> userArn = <span class="hljs-comment">/* The userArn */</span>;
<span class="hljs-keyword">const</span> sessionId = <span class="hljs-comment">/* The sessionId */</span>;
<span class="hljs-keyword">const</span> configuration = <span class="hljs-keyword">new</span> MessagingSessionConfiguration(userArn, sessionId, <span class="hljs-literal">undefined</span>, chime);
<span class="hljs-keyword">const</span> configuration = <span class="hljs-keyword">new</span> MessagingSessionConfiguration(userArn, sessionId, endpoint.Endpoint.Url, chime);
<span class="hljs-keyword">const</span> messagingSession = <span class="hljs-keyword">new</span> DefaultMessagingSession(configuration, logger);
</code></pre>
<a href="#building-and-testing" id="building-and-testing" style="color: inherit; text-decoration: none;">
Expand Down
Loading

0 comments on commit 7c3f964

Please sign in to comment.