Skip to content

Commit

Permalink
DefaultMessagingSession uses await on connect
Browse files Browse the repository at this point in the history
  • Loading branch information
daviwith committed Aug 16, 2022
1 parent 2a9c9e8 commit 7ffd1ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/modules/migrationto_3_0.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ <h3>Remove AWS global object from <code>MessagingSessionConfiguration.ts</code><
<p><code>MessagingSessionConfiguration</code> used to require to pass in the AWS global object for sigV4 signing which does not
work for aws-sdk v3. Starting with Amazon Chime SDK for JavaScript V3, you no longer have to pass in the global AWS object.</p>
<pre><code class="language-js"><span style="color: #008000">// Before</span>
<span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">configuration</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">MessagingSessionConfiguration</span><span style="color: #000000">(</span><span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">userArn</span><span style="color: #000000">, </span><span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">sessionId</span><span style="color: #000000">, </span><span style="color: #001080">endpoint</span><span style="color: #000000">.</span><span style="color: #001080">Endpoint</span><span style="color: #000000">.</span><span style="color: #001080">Url</span><span style="color: #000000">, </span><span style="color: #001080">chime</span><span style="color: #000000">, </span><span style="color: #0070C1">AWS</span><span style="color: #000000">);</span>
<span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">configuration</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">MessagingSessionConfiguration</span><span style="color: #000000">(</span><span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">userArn</span><span style="color: #000000">, </span><span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">sessionId</span><span style="color: #000000">, </span><span style="color: #0000FF">undefined</span><span style="color: #000000">, </span><span style="color: #001080">chime</span><span style="color: #000000">, </span><span style="color: #0070C1">AWS</span><span style="color: #000000">);</span>

<span style="color: #008000">// After</span>
<span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">configuration</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">MessagingSessionConfiguration</span><span style="color: #000000">(</span><span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">userArn</span><span style="color: #000000">, </span><span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">sessionId</span><span style="color: #000000">, </span><span style="color: #001080">endpoint</span><span style="color: #000000">.</span><span style="color: #001080">Endpoint</span><span style="color: #000000">.</span><span style="color: #001080">Url</span><span style="color: #000000">, </span><span style="color: #001080">chime</span><span style="color: #000000">);</span>
<span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">configuration</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">MessagingSessionConfiguration</span><span style="color: #000000">(</span><span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">userArn</span><span style="color: #000000">, </span><span style="color: #0000FF">this</span><span style="color: #000000">.</span><span style="color: #001080">sessionId</span><span style="color: #000000">, </span><span style="color: #0000FF">undefined</span><span style="color: #000000">, </span><span style="color: #001080">chime</span><span style="color: #000000">);</span>
</code></pre>
<a href="#update-messagingsessionstart-to-return-promiseltvoidgt-instead-of-void" id="update-messagingsessionstart-to-return-promiseltvoidgt-instead-of-void" style="color: inherit; text-decoration: none;">
<h3>Update <code>messagingSession.start</code> to return <code>Promise&lt;void&gt;</code> instead of <code>void</code></h3>
Expand Down
12 changes: 6 additions & 6 deletions test/messagingsession/DefaultMessagingSession.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ describe('DefaultMessagingSession', () => {
});
});

it('can reconnect with failures on getMessagingSession', async done => {
it('can reconnect with failures on getMessagingSession', done => {
configuration.chimeClient = v2ChimeClient;
let didStartCount = 0;
let didStartConnecting = 0;
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('DefaultMessagingSession', () => {
done();
},
});
await messagingSession.start();
messagingSession.start();
});

it('Ignores messages before SESSION_ESTABLISH', done => {
Expand Down Expand Up @@ -449,7 +449,7 @@ describe('DefaultMessagingSession', () => {
});

describe('reconnect', () => {
it('can reconnect', async done => {
it('can reconnect', done => {
let didStartCount = 0;
let didStartConnecting = 0;
messagingSession.addObserver({
Expand Down Expand Up @@ -480,10 +480,10 @@ describe('DefaultMessagingSession', () => {
done();
},
});
await messagingSession.start();
messagingSession.start();
});

it('will not reconnect', async done => {
it('will not reconnect', done => {
let didStartConnecting = 0;
messagingSession.addObserver({
messagingSessionDidStartConnecting(_reconnecting: boolean): void {
Expand All @@ -504,7 +504,7 @@ describe('DefaultMessagingSession', () => {
done();
},
});
await messagingSession.start();
messagingSession.start();
});

it('reconnect will stop after timeout', done => {
Expand Down

0 comments on commit 7ffd1ba

Please sign in to comment.