Comments (13)
@yuyaito Thanks a lot for opening the issue, we will try to include a patch fix for this one in next release.
from ruby-sdk.
Thank you for your response.
I have additional an information and a question.
Information.
In established one or more connection with Watson STT, if one websocket connection with Watson STT is closed, all the others connection is disconnected at the same time.
I think that a cause of this issue is below code.
on_close = lambda do |_event|
@client = nil
EM.stop_event_loop
end
The instance of Event Machine is one so all connection is stopped by stop_event_loop.
Please fix it additionally.
Question.
When is next release for fix this issue?
Thank you.
from ruby-sdk.
It will probably be fixed the first or second week of January. Right now most of the developers and on vacation.
from ruby-sdk.
@yuyaito I was able to re-create the first issue, and we will submit a patch for that. But I cannot re-create the second one you mentioned, can you please provide a snippet of how you are calling the web socket method.
from ruby-sdk.
Thank you for your confirmation.
Steps to reproduce as below.
- Modify ruby SDK as below.
websocket/speech_to_text_websocket_listener.rb l78
#before
EM&.reactor_thread&.join
#after
#EM&.reactor_thread&.join
-
Open two or more websocket connection with watson STT using modified SDK.
-
Close one of websocket connection. all the others connection is closed at the same time.
on_close = lambda do |_event|
@client = nil
EM.stop_event_loop
end
from ruby-sdk.
Please answer the question about this issue.
Q1. Please tell me the progress for this issue.
Q2. Could you understand the reason of problem?
Q3. When is the release for fix this issue?
from ruby-sdk.
Hi @yuyaito, We are investigating issues related to STT WebSocket and we are planning to have a patch out by the end of this month, and we are tracking work here.
from ruby-sdk.
@mamoonraja will this be fixed with the new release?
from ruby-sdk.
I am investigating this one.
from ruby-sdk.
@yuyaito I have verified that functionality to do recognition using 2 or more connections is working, we added an example of how to use WebSockets
in multiple threads here. E.g, To create two threads, you need to create two wrappers of service and then start the event machine in separate threads. Here's an example snippet:
speech = speech_to_text.recognize_using_websocket(
audio: File.open(Dir.getwd + "/resources/speech.wav"),
recognize_callback: MyRecognizeCallback.new,
interim_results: true,
timestamps: true,
max_alternatives: 2,
word_alternatives_threshold: 0.5,
content_type: "audio/wav"
)
speech_with_pause = speech_to_text.recognize_using_websocket(
audio: File.open(Dir.getwd + "/resources/sound-with-pause.wav"),
recognize_callback: MyRecognizeCallback.new,
interim_results: true,
timestamps: true,
max_alternatives: 2,
word_alternatives_threshold: 0.5,
content_type: "audio/wav"
)
main_thread = Thread.new { speech.start }
another_thread = Thread.new { speech_with_pause.start }
main_thread.join
another_thread.join
Please feel free to re-open if the issue persists.
from ruby-sdk.
Could you re-open this issue? I faced the same problem mentioned here.
WebSocket in STT on this SDK does not run correctly when calling two or more "recognize_using_websocket" method in Ruby on Rails(RoR).
The program stops at the following code.
# STOP ("ibm_watson/websocket/speech_to_text_websocket_listener.rb")
EM&.reactor_thread&.join
I came to mind as to what caused this problem.
This SDK uses EventMachine(EM).
The EM manual says that
it will result in Web server never binding to the socket). In that case, start event loop in a separate thread as demonstrated below.
https://www.rubydoc.info/github/eventmachine/eventmachine/EventMachine.run
I tried starting EventMachine event loop in a separate thread. The SDK no longer blocks the program.
Thread.new { EM.run -snip-} # at ibm_watson/websocket/speech_to_text_websocket_listener.rb"
If you have any concerns, please share them with us.
Would it be possible for you to do some action to avoid confusion when using this SDK with WEB app.
from ruby-sdk.
Hi! Looks like your problem was solved using the example for Starting EventMachine event loop in a separate thread
in https://www.rubydoc.info/github/eventmachine/eventmachine/EventMachine.run.
We do provide an example here: https://github.com/watson-developer-cloud/ruby-sdk/blob/master/examples/speech_to_text_v1.rb#L102 that shows how to run the program in a separate thread, which is similar to the example you posted.
Do you still need the issue to be opened again because it sounds like it's working for you now?
from ruby-sdk.
I solved the problem and the behavior is a specification of EM rather than a bug.
Furthermore, these comments are useful for developers who get lost in how to use.
I do not need the issue to be opened. Thanks for your comment.
from ruby-sdk.
Related Issues (18)
- Tone Analyzer: Invalid JSON input HOT 1
- Question about IAM authenticator token renewal HOT 1
- Issue with Ngrok and desactivating SSL
- Visual Recognition /classify classifier_ids should be array of strings, not string HOT 3
- Unnecessary deprecation warning for 'recognize_using_websocket' HOT 1
- IAMTokenManager leaks constants names HOT 3
- List the required dependencies along with their licenses HOT 2
- Speaker labels unavailable HOT 4
- Cannot Delete Custom Words of Full-Size (Double Byte) Alphanumeric. HOT 5
- Has Occured TypeError in STT Real-Time Recognition. HOT 11
- v1 Goals HOT 5
- "language_customization_id" does not work HOT 2
- Authentication fails using ibm-credentials.env file HOT 2
- Unauthorized error for NaturalLanguageUnderstandingV1 HOT 4
- Returns LoadError (cannot load such file -- ibm_watson/authenticators): HOT 11
- Speech to text not working with websockets HOT 2
- SpeechToTextV1 create_job Errno::EPIPE: Broken pipe HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-sdk.