Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support bi-directional transcribe streaming over Websocket #1216

Merged
merged 6 commits into from Jun 1, 2020

Conversation

AllanZhengYP
Copy link
Contributor

@AllanZhengYP AllanZhengYP commented May 28, 2020

Add customizations for Transcribe Streaming client to support bi-directional streaming in browsers over websocket. The client is compatible with ReactNative too. But currently there's no viable solution to access void record in chunks.

The customizations are in the @aws-sdk/middleware-sdk-transcribe-streaming package. They are crafted according to 'Using Amazon Transcribe Streaming with WebSockets'. The customizations are as below:

  1. middleware-endpoint: convert original http endpoint to Websocket endpint. Supplying custome endpoints for TranscribeStreaming in browser may lead to unknow behavior
  2. middleware-session-id: inject default session-id parameter in the request. Because websocket handler doesn't expose the request ID header from the response, we use session-id to map request to server-side logs. This middleware also inject other non-streaming response parameters like LanguageCode, MediaEncodeing, MediaSampleRateHertz, so that the SDK behavior is consistent in NodeJS runtime.
  3. signer: SigV4-based signer used to sign websocket request. It signs the request by presigning the request
  4. websocket-handler: An Websocket handler wrapped in a RequestHandler interface. The request's payload can be ReadableStream or AsyncIterable. The response from it has payload in AsyncIterable. But if ReadableStream constructor is available in the environment, the response payload is prefered in ReadableStream. This is for interface consistency across the browsers. If any error thrown from input stream, the handler will close the WebSocket connection and throw error from response payload stream.

TODO: Create a ReactNative library that emits recorder binary chunks so that RN users can supply recorder data to WebSocket API.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: cf3c4cd
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@AllanZhengYP AllanZhengYP marked this pull request as ready for review May 28, 2020 19:31
@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: e98d94d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@alexforsyth alexforsyth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor comments

Now this package can fully serialize & deserailize eventstream with web
APIs. In browsers, it converts from user-side iterables of input structure
to internal ReadableStream of binaries. In ReactNative, it converts from
user-side iterables of input structure to internal iterables of binaries.
The same applies to the other converting direction.
@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: 7e50b36
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@AllanZhengYP AllanZhengYP requested a review from kstich May 29, 2020 15:10
@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: 50bddce
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@AllanZhengYP
Copy link
Contributor Author

AllanZhengYP commented May 29, 2020

@trivikr The feedbacks regarding functional programming has been addressed in 90ef0e0. I appreciate it.

@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: 90ef0e0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Member

@trivikr trivikr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one minor comment

Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: d01b8c9
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: d01b8c9
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@kstich kstich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear from Java side.

@AllanZhengYP AllanZhengYP merged commit c8eef12 into aws:master Jun 1, 2020
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants