Class List Method List File List

# Class: VertxStomp::StompServerConnection

Inherits:
  Object
  - Object
  - VertxStomp::StompServerConnection
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/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.

## 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
  @return 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
  @return the STOMP server serving this connection.
- - (String) session
  @return 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.

## Instance Method Details

### - (`void`) close

This method returns an undefined value.

Closes the connection with the client.

Raises:

- (`ArgumentError`)

    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server_connection.rb', line 62

    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`)

    90
    91
    92
    93
    94
    95
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server_connection.rb', line 90

    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

@return the STOMP server handler dealing with this connection

Returns:

- (`::VertxStomp::StompServerHandler`)

Raises:

- (`ArgumentError`)

    46
    47
    48
    49
    50
    51
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server_connection.rb', line 46

    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`)

    79
    80
    81
    82
    83
    84
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server_connection.rb', line 79

    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`)

    70
    71
    72
    73
    74
    75
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server_connection.rb', line 70

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

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

@return the STOMP server serving this connection.

Returns:

- (`::VertxStomp::StompServer`)

Raises:

- (`ArgumentError`)

    38
    39
    40
    41
    42
    43
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server_connection.rb', line 38

    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

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

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    54
    55
    56
    57
    58
    59
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server_connection.rb', line 54

    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`)

    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server_connection.rb', line 26

    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