Class: Vertx::WebSocketFrame
- Inherits:
-
Object
- Object
- Vertx::WebSocketFrame
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/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.
Class Method Summary (collapse)
-
+ (::Vertx::WebSocketFrame) binary_frame(data = nil, isFinal = nil)
Create a binary WebSocket frame.
-
+ (::Vertx::WebSocketFrame) continuation_frame(data = nil, isFinal = nil)
Create a continuation frame.
-
+ (::Vertx::WebSocketFrame) text_frame(str = nil, isFinal = nil)
Create a text WebSocket frame.
Instance Method Summary (collapse)
-
- (true, false) binary?
@return true if it's a binary frame.
-
- (::Vertx::Buffer) binary_data
@return the data of the frame.
-
- (true, false) continuation?
@return true if it's a continuation frame.
-
- (true, false) final?
@return true if this is the final frame.
-
- (true, false) text?
@return true if it's a text frame.
-
- (String) text_data
@return the content of this frame as a UTF-8 string and returns the converted string.
Class Method Details
+ (::Vertx::WebSocketFrame) binary_frame(data = nil, isFinal = nil)
Create a binary WebSocket frame.
28 29 30 31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 28 def self.binary_frame(data=nil,isFinal=nil) if data.class.method_defined?(:j_del) && (isFinal.class == TrueClass || isFinal.class == FalseClass) && !block_given? return ::Vertx::WebSocketFrame.new(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:binaryFrame, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::boolean.java_class]).call(data.j_del,isFinal)) end raise ArgumentError, "Invalid arguments when calling binary_frame(data,isFinal)" end |
+ (::Vertx::WebSocketFrame) continuation_frame(data = nil, isFinal = nil)
Create a continuation frame
48 49 50 51 52 53 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 48 def self.continuation_frame(data=nil,isFinal=nil) if data.class.method_defined?(:j_del) && (isFinal.class == TrueClass || isFinal.class == FalseClass) && !block_given? return ::Vertx::WebSocketFrame.new(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:continuationFrame, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::boolean.java_class]).call(data.j_del,isFinal)) end raise ArgumentError, "Invalid arguments when calling continuation_frame(data,isFinal)" end |
+ (::Vertx::WebSocketFrame) text_frame(str = nil, isFinal = nil)
Create a text WebSocket frame.
38 39 40 41 42 43 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 38 def self.text_frame(str=nil,isFinal=nil) if str.class == String && (isFinal.class == TrueClass || isFinal.class == FalseClass) && !block_given? return ::Vertx::WebSocketFrame.new(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:textFrame, [Java::java.lang.String.java_class,Java::boolean.java_class]).call(str,isFinal)) end raise ArgumentError, "Invalid arguments when calling text_frame(str,isFinal)" end |
Instance Method Details
- (true, false) binary?
@return true if it's a binary frame
64 65 66 67 68 69 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 64 def binary? if !block_given? return @j_del.java_method(:isBinary, []).call() end raise ArgumentError, "Invalid arguments when calling binary?()" end |
- (::Vertx::Buffer) binary_data
@return the data of the frame
92 93 94 95 96 97 98 99 100 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 92 def binary_data if !block_given? if @cached_binary_data != nil return @cached_binary_data end return @cached_binary_data = ::Vertx::Buffer.new(@j_del.java_method(:binaryData, []).call()) end raise ArgumentError, "Invalid arguments when calling binary_data()" end |
- (true, false) continuation?
@return true if it's a continuation frame
72 73 74 75 76 77 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 72 def continuation? if !block_given? return @j_del.java_method(:isContinuation, []).call() end raise ArgumentError, "Invalid arguments when calling continuation?()" end |
- (true, false) final?
@return true if this is the final frame.
103 104 105 106 107 108 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 103 def final? if !block_given? return @j_del.java_method(:isFinal, []).call() end raise ArgumentError, "Invalid arguments when calling final?()" end |
- (true, false) text?
@return true if it's a text frame
56 57 58 59 60 61 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 56 def text? if !block_given? return @j_del.java_method(:isText, []).call() end raise ArgumentError, "Invalid arguments when calling text?()" end |
- (String) text_data
@return the content of this frame as a UTF-8 string and returns the
converted string. Only use this for text frames.
81 82 83 84 85 86 87 88 89 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/web_socket_frame.rb', line 81 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 raise ArgumentError, "Invalid arguments when calling text_data()" end |