View Source ExGoogleSTT.StreamingServer (Google Speech gRPC API v0.0.1)
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
t:Google.Cloud.Speech.V2.StreamingRecognizeRequest.t/0 struct created using
Google.Cloud.Speech.V2.StreamingRecognizeRequest.
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 t:Google.Cloud.Speech.V2.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 Server
- Send a config request with
Google.Cloud.Speech.V2.StreamingRecognitionConfig - Send request(s) with
Google.Cloud.Speech.V2.RecognitionAudiocontaining audio data - (async) Receive messages conatining
Google.Cloud.Speech.V2.StreamingRecognizeResponse - Send final
Google.Cloud.Speech.V2.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
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 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 linked client process.
Stops a client process.
Types
@type message() :: Google.Cloud.Speech.V2.StreamingRecognizeResponse.t() | {pid(), Google.Cloud.Speech.V2.StreamingRecognizeResponse.t()}
Format of messages sent by the client to the target
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec end_stream(client :: pid()) :: :ok
Closes a client-side gRPC stream.
@spec send_config( client :: pid(), Google.Cloud.Speech.V2.StreamingRecognizeRequest.t(), Keyword.t() ) :: :ok
Sends a request to the API. If option end_stream: true is passed,
closes a client-side gRPC stream.
@spec send_request( client :: pid(), Google.Cloud.Speech.V2.StreamingRecognizeRequest.t(), Keyword.t() ) :: :ok
Sends a request to the API. If option end_stream: true is passed,
closes a client-side gRPC stream.
@spec send_requests( client :: pid(), [Google.Cloud.Speech.V2.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 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.
@spec stop(client :: pid()) :: :ok
Stops a client process.