Sha256: 5ec7cf1f0457d4deef57fa81e5d570753e9c3035072dadb159244b32f0a4b45c
Contents?: true
Size: 984 Bytes
Versions: 4
Compression:
Stored size: 984 Bytes
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
Version data entries
4 entries across 4 versions & 1 rubygems