Class: XRBP::WebSocket::Fallback

Inherits:
MultiConnection show all
Defined in:
lib/xrbp/websocket/multi/fallback.rb

Overview

MultiConnection strategy where connections are tried sequentially until one is found that is open & succeeds

Instance Attribute Summary

Attributes inherited from MultiConnection

#connections

Instance Method Summary collapse

Methods inherited from MultiConnection

#_add_plugin, #add_plugin, #close!, #connect, #force_quit!, #initialize, #plugin_namespace, #wait_for_close, #wait_for_completed, #wait_for_open

Constructor Details

This class inherits a constructor from XRBP::WebSocket::MultiConnection

Instance Method Details

#next_connection(prev = nil) ⇒ Object


6
7
8
9
10
11
12
13
# File 'lib/xrbp/websocket/multi/fallback.rb', line 6

def next_connection(prev=nil)
  unless prev.nil?
    return nil if connections.last == prev
    return connections[(connections.index(prev) + 1)..-1].find { |c| !c.closed? }
  end

  connections.find { |c| !c.closed? }
end