lib/websocket/eventmachine/client.rb in websocket-eventmachine-client-1.1.0 vs lib/websocket/eventmachine/client.rb in websocket-eventmachine-client-1.2.0

- old
+ new

@@ -17,10 +17,11 @@ # Connect to websocket server # @param args [Hash] The request arguments # @option args [String] :host The host IP/DNS name # @option args [Integer] :port The port to connect too(default = 80) + # @option args [String] :uri Full URI for server(optional - use instead of host/port combination) # @option args [Integer] :version Version of protocol to use(default = 13) # @option args [Hash] :headers HTTP headers to use in the handshake # @option args [Boolean] :ssl Force SSL/TLS connection def self.connect(args = {}) host = nil @@ -39,10 +40,21 @@ port ||= 80 end ::EventMachine.connect host, port, self, args end + + # Make a websocket connection to a UNIX-domain socket. + # @param socketname [String] Unix domain socket (local fully-qualified path) + # @param args [Hash] Arguments for connection + # @option args [Integer] :version Version of protocol to use(default = 13) + # @option args [Hash] :headers HTTP headers to use in the handshake + def self.connect_unix_domain(socketname, args = {}) + fail ArgumentError, 'invalid socket' unless File.socket?(socketname) + args[:host] ||= 'localhost' + ::EventMachine.connect_unix_domain socketname, self, args + end # Initialize connection # @param args [Hash] Arguments for connection # @option args [String] :host The host IP/DNS name # @option args [Integer] :port The port to connect too(default = 80) @@ -123,10 +135,10 @@ # Called when ping message is received # One parameter passed to block: # message - string with ping message def onping(&blk); super; end - # Called when pond message is received + # Called when pong message is received # One parameter passed to block: # message - string with pong message def onpong(&blk); super; end # Send data