Sha256: 31a26e4b12ef819b8844aaeb57e98b3b062a9551bd11f89162b74952c90710ce

Contents?: true

Size: 887 Bytes

Versions: 2

Compression:

Stored size: 887 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.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

module Protocol
	module WebSocket
    class TextFrame

      def unpack
        encoded_readed_string = super.encode(Encoding::UTF_8)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deepstream-1.0.1 lib/deepstream/async_patch.rb
deepstream-1.0.0 lib/deepstream/async_patch.rb