Sha256: 97376d1bfa7473354f9bd116160427b392066f560488f4cfc7d5916892d59e1d
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
module Async module WebSocket class Client < ::Protocol::HTTP::Middleware include ::Protocol::WebSocket::Headers def self.open(endpoint, *args, &block) client = self.new(HTTP::Client.new(endpoint, *args), mask: true) return client unless block_given? begin yield client ensure client.close end end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deepstream-1.0.3 | lib/deepstream/async_patch.rb |