Skip to content

Commit

Permalink
Add documentation regarding Client.open and Client.connect.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Sep 28, 2019
1 parent 1c4ebb9 commit 9ee0698
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/async/websocket/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module WebSocket
class Client < ::Protocol::HTTP::Middleware
include ::Protocol::WebSocket::Headers

# @return [Client] a client which can be used to establish websocket connections to the given endpoint.
def self.open(endpoint, *args, &block)
client = self.new(HTTP::Client.new(endpoint, *args), mask: endpoint.secure?)

Expand All @@ -48,6 +49,7 @@ def self.open(endpoint, *args, &block)
end
end

# @return [Connection] an open websocket connection to the given endpoint.
def self.connect(endpoint, *args, **options, &block)
self.open(endpoint, *args) do |client|
connection = client.connect(endpoint.path, **options)
Expand Down

0 comments on commit 9ee0698

Please sign in to comment.