Class List Method List File List

# Class: VertxStomp::StompServerConnection

Inherits:
  Object
  - Object
  - VertxStomp::StompServerConnection
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb

## Overview

Class representing a connection between a STOMP client a the server. It keeps a references on the client socket, so let write to this socket.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) close
  Closes the connection with the client.
- - (void) configure_heartbeat(ping = nil, pong = nil) { ... }
  Configures the heartbeat.
- - (::VertxStomp::StompServerHandler) handler
  The STOMP server handler dealing with this connection.
- - (void) on_server_activity
  Notifies the connection about server activity (the server has sent a frame).
- - (void) ping
  Sends a `PING` frame to the client.
- - (::VertxStomp::StompServer) server
  The STOMP server serving this connection.
- - (String) session
  The STOMP session id computed when the client has established the connection to the server.
- - (self) write(param_1 = nil)
  Writes the given buffer to the socket.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    21
    22
    23
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 21

    def @@j_api_type.accept?(obj)
      obj.class == StompServerConnection
    end

### + (`Object`) j_api_type

    30
    31
    32
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 30

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    33
    34
    35
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 33

    def self.j_class
      Java::IoVertxExtStomp::StompServerConnection.java_class
    end

### + (`Object`) unwrap(obj)

    27
    28
    29
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 27

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    24
    25
    26
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 24

    def @@j_api_type.wrap(obj)
      StompServerConnection.new(obj)
    end

## Instance Method Details

### - (`void`) close

This method returns an undefined value.

Closes the connection with the client.

Raises:

- (`ArgumentError`)

    75
    76
    77
    78
    79
    80
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 75

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

### - (`void`) configure_heartbeat(ping = nil, pong = nil) { ... }

This method returns an undefined value.

Configures the heartbeat.

Parameters:

- ping (`Fixnum`) (defaults to: `nil`) —
  ping time
- pong (`Fixnum`) (defaults to: `nil`) —
  pong time

Yields:

- the ping handler

Raises:

- (`ArgumentError`)

    103
    104
    105
    106
    107
    108
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 103

    def configure_heartbeat(ping=nil,pong=nil)
      if ping.class == Fixnum && pong.class == Fixnum && block_given?
        return @j_del.java_method(:configureHeartbeat, [Java::long.java_class,Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(ping,pong,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxStomp::StompServerConnection)) }))
      end
      raise ArgumentError, "Invalid arguments when calling configure_heartbeat(#{ping},#{pong})"
    end

### - (`::VertxStomp::StompServerHandler`) handler

Returns the STOMP server handler dealing with this connection

Returns:

- (`::VertxStomp::StompServerHandler`) —
  the STOMP server handler dealing with this connection

Raises:

- (`ArgumentError`)

    60
    61
    62
    63
    64
    65
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 60

    def handler
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:handler, []).call(),::VertxStomp::StompServerHandler)
      end
      raise ArgumentError, "Invalid arguments when calling handler()"
    end

### - (`void`) on_server_activity

This method returns an undefined value.

Notifies the connection about server activity (the server has sent a frame). This method is used to handle the heartbeat.

Raises:

- (`ArgumentError`)

    92
    93
    94
    95
    96
    97
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 92

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

### - (`void`) ping

This method returns an undefined value.

Sends a `PING` frame to the client. A `PING` frame is a frame containing only `EOL`.

Raises:

- (`ArgumentError`)

    83
    84
    85
    86
    87
    88
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 83

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

### - (`::VertxStomp::StompServer`) server

Returns the STOMP server serving this connection.

Returns:

- (`::VertxStomp::StompServer`) —
  the STOMP server serving this connection.

Raises:

- (`ArgumentError`)

    53
    54
    55
    56
    57
    58
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 53

    def server
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:server, []).call(),::VertxStomp::StompServer)
      end
      raise ArgumentError, "Invalid arguments when calling server()"
    end

### - (`String`) session

Returns the STOMP session id computed when the client has established the connection to the server

Returns:

- (`String`) —
  the STOMP session id computed when the client has established the connection to the server

Raises:

- (`ArgumentError`)

    67
    68
    69
    70
    71
    72
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 67

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

### - (`self`) write(frame) - (`self`) write(buffer)

Writes the given buffer to the socket. This is a low level API that should be used carefully.

Overloads:

- - (`self`) write(frame)

  Parameters:

  - frame (`Hash`) —
    the frame, must not be `null`.
- - (`self`) write(buffer)

  Parameters:

  - buffer (`::Vertx::Buffer`) —
    the buffer

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server_connection.rb', line 42

    def write(param_1=nil)
      if param_1.class == Hash && !block_given?
        @j_del.java_method(:write, [Java::IoVertxExtStomp::Frame.java_class]).call(Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(param_1)))
        return self
      elsif param_1.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:write, [Java::IoVertxCoreBuffer::Buffer.java_class]).call(param_1.j_del)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling write(#{param_1})"
    end