Class: Vertx::WebSocketFrame

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb

Overview

A WebSocket frame that represents either text or binary data.

A WebSocket message is composed of one or more WebSocket frames.

If there is a just a single frame in the message then a single text or binary frame should be created with final = true.

If there are more than one frames in the message, then the first frame should be a text or binary frame with final = false, followed by one or more continuation frames. The last continuation frame should have final = true.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (::Vertx::WebSocketFrame) binaryFrame(data, isFinal)

Create a binary WebSocket frame.

Parameters:

  • data (::Vertx::Buffer)
    the data for the frame
  • isFinal (true, false)
    true if it's the final frame in the WebSocket message

Returns:



182
183
184
185
186
187
188
189
190
191
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 182

def self.binary_frame(*args)
  if args[0].class.method_defined?(:j_del) && (args[1].class == TrueClass || args[1].class == FalseClass) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:binaryFrame, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::boolean.java_class]).call(args[0].j_del,args[1]),::Vertx::WebSocketFrame)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling binary_frame(#{args[0]},#{args[1]})"
  end
end

+ (::Vertx::WebSocketFrame) continuationFrame(data, isFinal)

Create a continuation frame

Parameters:

  • data (::Vertx::Buffer)
    the data for the frame
  • isFinal (true, false)
    true if it's the final frame in the WebSocket message

Returns:



123
124
125
126
127
128
129
130
131
132
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 123

def self.continuation_frame(*args)
  if args[0].class.method_defined?(:j_del) && (args[1].class == TrueClass || args[1].class == FalseClass) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:continuationFrame, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::boolean.java_class]).call(args[0].j_del,args[1]),::Vertx::WebSocketFrame)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling continuation_frame(#{args[0]},#{args[1]})"
  end
end

+ (Object) j_api_type



35
36
37
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 35

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



38
39
40
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 38

def self.j_class
  Java::IoVertxCoreHttp::WebSocketFrame.java_class
end

+ (::Vertx::WebSocketFrame) pingFrame(data)

Create a ping WebSocket frame. Will be a final frame. There is no option for non final ping frames.

Parameters:

  • data (::Vertx::Buffer)
    the bytes for the frame, may be at most 125 bytes

Returns:



167
168
169
170
171
172
173
174
175
176
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 167

def self.ping_frame(*args)
  if args[0].class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:pingFrame, [Java::IoVertxCoreBuffer::Buffer.java_class]).call(args[0].j_del),::Vertx::WebSocketFrame)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling ping_frame(#{args[0]})"
  end
end

+ (::Vertx::WebSocketFrame) pongFrame(data)

Create a pong WebSocket frame. Will be a final frame. There is no option for non final pong frames.

Parameters:

  • data (::Vertx::Buffer)
    the bytes for the frame, may be at most 125 bytes

Returns:



69
70
71
72
73
74
75
76
77
78
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 69

def self.pong_frame(*args)
  if args[0].class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:pongFrame, [Java::IoVertxCoreBuffer::Buffer.java_class]).call(args[0].j_del),::Vertx::WebSocketFrame)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling pong_frame(#{args[0]})"
  end
end

+ (::Vertx::WebSocketFrame) textFrame(str, isFinal)

Create a text WebSocket frame.

Parameters:

  • str (String)
    the string for the frame
  • isFinal (true, false)
    true if it's the final frame in the WebSocket message

Returns:



84
85
86
87
88
89
90
91
92
93
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 84

def self.text_frame(*args)
  if args[0].class == String && (args[1].class == TrueClass || args[1].class == FalseClass) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:textFrame, [Java::java.lang.String.java_class,Java::boolean.java_class]).call(args[0],args[1]),::Vertx::WebSocketFrame)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling text_frame(#{args[0]},#{args[1]})"
  end
end

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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

Instance Method Details

- (true, false) isBinary

Returns true if it's a binary frame

Returns:

  • (true, false)
    true if it's a binary frame


108
109
110
111
112
113
114
115
116
117
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 108

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

- (::Vertx::Buffer) binaryData

Returns the data of the frame

Returns:



150
151
152
153
154
155
156
157
158
159
160
161
162
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 150

def binary_data
  if !block_given?
    if @cached_binary_data != nil
      return @cached_binary_data
    end
    return @cached_binary_data = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:binaryData, []).call(),::Vertx::Buffer)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling binary_data()"
  end
end

- (true, false) isClose

Returns true if it's close frame

Returns:

  • (true, false)
    true if it's close frame


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

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

- (String) closeReason

Returns string explaining close reason. Only use this for close frames

Returns:

  • (String)
    string explaining close reason. Only use this for close frames


206
207
208
209
210
211
212
213
214
215
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 206

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

- (Fixnum) closeStatusCode

Returns status code of close frame. Only use this for close frames

Returns:

  • (Fixnum)
    status code of close frame. Only use this for close frames


55
56
57
58
59
60
61
62
63
64
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 55

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

- (true, false) isContinuation

Returns true if it's a continuation frame

Returns:

  • (true, false)
    true if it's a continuation frame


96
97
98
99
100
101
102
103
104
105
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 96

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

- (true, false) isFinal

Returns true if this is the final frame.

Returns:

  • (true, false)
    true if this is the final frame.


194
195
196
197
198
199
200
201
202
203
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 194

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

- (true, false) isText

Returns true if it's a text frame

Returns:

  • (true, false)
    true if it's a text frame


218
219
220
221
222
223
224
225
226
227
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 218

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

- (String) textData

Returns the content of this frame as a UTF-8 string and returns the converted string. Only use this for text frames.

Returns:

  • (String)
    the content of this frame as a UTF-8 string and returns the converted string. Only use this for text frames.


135
136
137
138
139
140
141
142
143
144
145
146
147
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 135

def text_data
  if !block_given?
    if @cached_text_data != nil
      return @cached_text_data
    end
    return @cached_text_data = @j_del.java_method(:textData, []).call()
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling text_data()"
  end
end