Google Cloud Speech gRPC API v0.4.0 GCloud.SpeechAPI.Streaming.Client View Source
A client process for Streaming API.
Once a client is started, it establishes a connection to the Streaming API, gets ready to send requests to the API and forwards incoming responses to a set process.
Requests
The requests can be sent using send_request/3. Each request should be a
Google.Cloud.Speech.V1.StreamingRecognizeRequest.t/0 struct created using
Google.Cloud.Speech.V1.StreamingRecognizeRequest.new/1 accepting keyword with struct fields.
This is an auto-generated module, so check out this notice and
API reference
Responses
The client sends responses from API via messages to the target (by default it is the process that spawned client).
Each message is a struct Google.Cloud.Speech.V1.StreamingRecognizeResponse.t/0 or a tuple with pid of sender and the same struct. Message format is controlled by include_sender option of a client.
Usage
- Start the client
- Send request with
Google.Cloud.Speech.V1.StreamingRecognitionConfig - Send request(s) with
Google.Cloud.Speech.V1.RecognitionAudiocontaining audio data - (async) Receive messages conatining
Google.Cloud.Speech.V1.StreamingRecognizeResponse - Send final
Google.Cloud.Speech.V1.RecognitionAudiowith optionend_stream: trueor callend_stream/1after final audio chunk has been sent. - Stop the client after receiving all results
See README for code example
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Closes a client-side gRPC stream.
Sends a request to the API. If option end_stream: true is passed,
closes a client-side gRPC stream.
Sends a list of requests to the API. If option end_stream: true is passed,
closes a client-side gRPC stream.
Starts a client process without links.
Starts a linked client process.
Stops a client process.
Link to this section Types
Format of messages sent by the client to the target
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Closes a client-side gRPC stream.
send_request(pid, request, opts \\ [])
View Sourcesend_request( client :: pid(), Google.Cloud.Speech.V1.StreamingRecognizeRequest.t(), Keyword.t() ) :: :ok
Sends a request to the API. If option end_stream: true is passed,
closes a client-side gRPC stream.
send_requests(pid, request, opts \\ [])
View Sourcesend_requests( client :: pid(), [Google.Cloud.Speech.V1.StreamingRecognizeRequest.t()], Keyword.t() ) :: :ok
Sends a list of requests to the API. If option end_stream: true is passed,
closes a client-side gRPC stream.
Starts a client process without links.
See start_link/1 for more info
Starts a linked client process.
Possible options are:
target- A pid of a process that will receive recognition results. Defaults toself().monitor_target- If set to true, a client will monitor the target and shutdown if the target is downinclude_sender- If true, a client will include its pid in messages sent to the target.start_time- Time by which response times will be shifted in nanoseconds. Defaults to0ns.
Stops a client process.