class Async::WebSocket::Client

Public Class Methods

connect(endpoint, *args, **options) { |connection| ... } click to toggle source
# File lib/deepstream/async_patch.rb, line 6
def self.connect(endpoint, *args, **options, &block)
  self.open(endpoint, *args) do |client|
    connection = client.connect(endpoint.authority, endpoint.path, **options)
 
    return connection unless block_given?

    begin
      yield connection
    ensure
      connection.close
    end
  rescue
    puts "cant connect to #{endpoint}"
  end
end