1111
1212# Class for interacting with the WebSocket API
1313class WebSocketClient
14- def initialize ( audio : nil , chunk_data :, options :, recognize_callback :, url :, headers :, disable_ssl : false )
14+ def initialize ( audio : nil , chunk_data :, options :, recognize_callback :, url :, headers :, disable_ssl_verification : false )
1515 @audio = audio
1616 @options = options
1717 @callback = recognize_callback
@@ -24,7 +24,7 @@ def initialize(audio: nil, chunk_data:, options:, recognize_callback:, url:, hea
2424 @mic_running = false
2525 @data_size = audio . nil? ? 0 : @audio . size
2626 @queue = Queue . new
27- @disable_ssl = disable_ssl
27+ @disable_ssl_verification = disable_ssl_verification
2828 end
2929
3030 def start
@@ -78,13 +78,12 @@ def start
7878
7979 EM &.reactor_thread &.join
8080 EM . run do
81- if @disable_ssl
81+ if @disable_ssl_verification
8282 @url = @url . sub ( "wss:" , "ws:" )
8383 @client = Faye ::WebSocket ::Client . new ( @url , nil , tls : { verify_peer : false , fail_if_no_peer_cert : false } , headers : @headers )
8484 else
8585 @client = Faye ::WebSocket ::Client . new ( @url , nil , headers : @headers )
8686 end
87- @client = Faye ::WebSocket ::Client . new ( @url , nil , headers : @headers )
8887 @client . onclose = on_close
8988 @client . onerror = on_error
9089 @client . onmessage = on_message
0 commit comments