Class List Method List File List

# Class: VertxWeb::BridgeEvent

Inherits:
  Vertx::Future
  - Object
  - Vertx::Future
  - VertxWeb::BridgeEvent
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb

## Overview

Represents an event that occurs on the event bus bridge.

Please consult the documentation for a full explanation.

## Instance Method Summary (collapse)

- - (Hash{String => Object}) get_raw_message
  Get the raw JSON message for the event.
- - (Hash{String => Object}) raw_message
  Use #get_raw_message instead, will be removed in 3.3.
- - (self) set_raw_message(message = nil)
  Get the raw JSON message for the event.
- - (::VertxWeb::SockJSSocket) socket
  Get the SockJSSocket instance corresponding to the event.
- - (:SOCKET_CREATED, ...) type
  @return the type of the event.

### Methods inherited from Vertx::Future

#cause, #complete, #complete?, #completer, #compose, #fail, #failed?, failed_future, future, #map, #result, #set_handler, #succeeded?, succeeded_future

## Instance Method Details

### - (`Hash{String => Object}`) get_raw_message

Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is no message involved. If the returned message is modified, #set_raw_message should be called with the new message.

Returns:

- (`Hash{String => Object}`) —
  the raw JSON message for the event

Raises:

- (`ArgumentError`)

    47
    48
    49
    50
    51
    52
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 47

    def get_raw_message
      if !block_given?
        return @j_del.java_method(:getRawMessage, []).call() != nil ? JSON.parse(@j_del.java_method(:getRawMessage, []).call().encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling get_raw_message()"
    end

### - (`Hash{String => Object}`) raw_message

Use #get_raw_message instead, will be removed in 3.3

Returns:

- (`Hash{String => Object}`)

Raises:

- (`ArgumentError`)

    34
    35
    36
    37
    38
    39
    40
    41
    42
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 34

    def raw_message
      if !block_given?
        if @cached_raw_message != nil
          return @cached_raw_message
        end
        return @cached_raw_message = @j_del.java_method(:rawMessage, []).call() != nil ? JSON.parse(@j_del.java_method(:rawMessage, []).call().encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling raw_message()"
    end

### - (`self`) set_raw_message(message = nil)

Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is no message involved.

Parameters:

- message (`Hash{String => Object}`) (defaults to: `nil`) —
  the raw message

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    57
    58
    59
    60
    61
    62
    63
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 57

    def set_raw_message(message=nil)
      if message.class == Hash && !block_given?
        @j_del.java_method(:setRawMessage, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(message))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_raw_message(message)"
    end

### - (`::VertxWeb::SockJSSocket`) socket

Get the SockJSSocket instance corresponding to the event

Returns:

- (`::VertxWeb::SockJSSocket`) —
  the SockJSSocket instance

Raises:

- (`ArgumentError`)

    66
    67
    68
    69
    70
    71
    72
    73
    74
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 66

    def socket
      if !block_given?
        if @cached_socket != nil
          return @cached_socket
        end
        return @cached_socket = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:socket, []).call(),::VertxWeb::SockJSSocket)
      end
      raise ArgumentError, "Invalid arguments when calling socket()"
    end

### - (`:SOCKET_CREATED`, ...) type

@return the type of the event

Returns:

- (`:SOCKET_CREATED`, `:SOCKET_CLOSED`, `:SEND`, `:PUBLISH`, `:RECEIVE`, `:REGISTER`, `:UNREGISTER`)

Raises:

- (`ArgumentError`)

    23
    24
    25
    26
    27
    28
    29
    30
    31
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 23

    def type
      if !block_given?
        if @cached_type != nil
          return @cached_type
        end
        return @cached_type = @j_del.java_method(:type, []).call().name.intern
      end
      raise ArgumentError, "Invalid arguments when calling type()"
    end