Module: WebSocket::Client::Simple

Defined in:
lib/simple_websocket_vcr/monkey_patch.rb

Class Method Summary collapse

Class Method Details

.connect(url, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/simple_websocket_vcr/monkey_patch.rb', line 5

def connect(url, options = {})
  if WebSocketVCR.configuration.hook_uris.any? { |u| url.include?(u) }
    cassette = WebSocketVCR.cassette
    live = cassette.recording?
    real_client = real_connect(url, options) if live
    fake_client = WebSocketVCR::RecordableWebsocketClient.new(cassette, live ? real_client : nil)
    yield fake_client if block_given?
    fake_client
  else
    real_connect(url, options)
  end
end

.real_connectObject



3
# File 'lib/simple_websocket_vcr/monkey_patch.rb', line 3

alias_method :real_connect, :connect