Class List Method List File List

# Class: Vertx::WebSocketStream

Inherits:
  Object
  - Object
  - Vertx::WebSocketStream
  show all
Includes:
  ReadStream
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_stream.rb

## Overview

A stream for HttpClient WebSocket connection.

When the connection attempt is successful, the stream handler is called back with the WebSocket argument, immediately followed by a call to the end handler. When the connection attempt fails, the exception handler is invoked.

The connection occurs when the #handler method is called with a non null handler, the other handlers should be set before setting the handler.

## Instance Method Summary (collapse)

- - (self) end_handler { ... }
- - (self) exception_handler { ... }
- - (self) handler { ... }
- - (self) pause
- - (self) resume

## Instance Method Details

### - (`self`) end_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    61
    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_stream.rb', line 61

    def end_handler
      if block_given?
        @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling end_handler()"
    end

### - (`self`) exception_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    27
    28
    29
    30
    31
    32
    33
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_stream.rb', line 27

    def exception_handler
      if block_given?
        @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling exception_handler()"
    end

### - (`self`) handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    36
    37
    38
    39
    40
    41
    42
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_stream.rb', line 36

    def handler
      if block_given?
        @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::WebSocket)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling handler()"
    end

### - (`self`) pause

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    44
    45
    46
    47
    48
    49
    50
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_stream.rb', line 44

    def pause
      if !block_given?
        @j_del.java_method(:pause, []).call()
        return self
      end
      raise ArgumentError, "Invalid arguments when calling pause()"
    end

### - (`self`) resume

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    52
    53
    54
    55
    56
    57
    58
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_stream.rb', line 52

    def resume
      if !block_given?
        @j_del.java_method(:resume, []).call()
        return self
      end
      raise ArgumentError, "Invalid arguments when calling resume()"
    end