Sha256: ce7f9ae59109525ba5155205a9248ba8fca46763bb2f3a1c88b68406d14d3d30

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

module Async
  module WebSocket
    class Client < ::Protocol::HTTP::Middleware
      include ::Protocol::WebSocket::Headers

      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
    end

    class Connection < ::Protocol::WebSocket::Connection

      def write(object)
        super(object)
      end

      def parse(buffer)
        buffer
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deepstream-1.0.10 lib/deepstream/async_patch.rb
deepstream-1.0.9 lib/deepstream/async_patch.rb
deepstream-1.0.8 lib/deepstream/async_patch.rb