Class: Vertx::WebSocketFrame
- Inherits:
-
Object
- Object
- Vertx::WebSocketFrame
- 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)
- + (Boolean) accept?(obj)
-
+ (::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.
- + (Object) j_api_type
- + (Object) j_class
-
+ (::Vertx::WebSocketFrame) ping_frame(data = nil)
Create a ping WebSocket frame.
-
+ (::Vertx::WebSocketFrame) pong_frame(data = nil)
Create a pong WebSocket frame.
-
+ (::Vertx::WebSocketFrame) text_frame(str = nil, isFinal = nil)
Create a text WebSocket frame.
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (true, false) binary?
True if it's a binary frame.
-
- (::Vertx::Buffer) binary_data
The data of the frame.
-
- (true, false) close?
True if it's close frame.
-
- (String) close_reason
String explaining close reason.
-
- (Fixnum) close_status_code
Status code of close frame.
-
- (true, false) continuation?
True if it's a continuation frame.
-
- (true, false) final?
True if this is the final frame.
-
- (true, false) text?
True if it's a text frame.
-
- (String) text_data
The content of this frame as a UTF-8 string and returns the converted string.
Class Method Details
+ (Boolean) accept?(obj)
25 26 27 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 25 def @@j_api_type.accept?(obj) obj.class == WebSocketFrame end |
+ (::Vertx::WebSocketFrame) binary_frame(data = nil, isFinal = nil)
Create a binary WebSocket frame.
44 45 46 47 48 49 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 44 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::Util::Utils.safe_create(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:binaryFrame, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::boolean.java_class]).call(data.j_del,isFinal),::Vertx::WebSocketFrame) end raise ArgumentError, "Invalid arguments when calling binary_frame(#{data},#{isFinal})" end |
+ (::Vertx::WebSocketFrame) continuation_frame(data = nil, isFinal = nil)
Create a continuation frame
82 83 84 85 86 87 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 82 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::Util::Utils.safe_create(Java::IoVertxCoreHttp::WebSocketFrame.java_method(:continuationFrame, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::boolean.java_class]).call(data.j_del,isFinal),::Vertx::WebSocketFrame) end raise ArgumentError, "Invalid arguments when calling continuation_frame(#{data},#{isFinal})" end |
+ (Object) j_api_type
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 34 def self.j_api_type @@j_api_type end |
+ (Object) j_class
37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 37 def self.j_class Java::IoVertxCoreHttp::WebSocketFrame.java_class end |
+ (::Vertx::WebSocketFrame) ping_frame(data = nil)
Create a ping WebSocket frame. Will be a final frame. There is no option for non final ping frames.
63 64 65 66 67 68 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 63 def self.ping_frame(data=nil) if data.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(data.j_del),::Vertx::WebSocketFrame) end raise ArgumentError, "Invalid arguments when calling ping_frame(#{data})" end |
+ (::Vertx::WebSocketFrame) pong_frame(data = nil)
Create a pong WebSocket frame. Will be a final frame. There is no option for non final pong frames.
72 73 74 75 76 77 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 72 def self.pong_frame(data=nil) if data.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(data.j_del),::Vertx::WebSocketFrame) end raise ArgumentError, "Invalid arguments when calling pong_frame(#{data})" end |
+ (::Vertx::WebSocketFrame) text_frame(str = nil, isFinal = nil)
Create a text WebSocket frame.
54 55 56 57 58 59 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 54 def self.text_frame(str=nil,isFinal=nil) if str.class == String && (isFinal.class == TrueClass || isFinal.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(str,isFinal),::Vertx::WebSocketFrame) end raise ArgumentError, "Invalid arguments when calling text_frame(#{str},#{isFinal})" end |
+ (Object) unwrap(obj)
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 31 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 28 def @@j_api_type.wrap(obj) WebSocketFrame.new(obj) end |
Instance Method Details
- (true, false) binary?
Returns true if it's a binary frame
96 97 98 99 100 101 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 96 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
Returns the data of the frame
127 128 129 130 131 132 133 134 135 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 127 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 raise ArgumentError, "Invalid arguments when calling binary_data()" end |
- (true, false) close?
Returns true if it's close frame
110 111 112 113 114 115 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 110 def close? if !block_given? return @j_del.java_method(:isClose, []).call() end raise ArgumentError, "Invalid arguments when calling close?()" end |
- (String) close_reason
Returns string explaining close reason. Only use this for close frames
151 152 153 154 155 156 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 151 def close_reason if !block_given? return @j_del.java_method(:closeReason, []).call() end raise ArgumentError, "Invalid arguments when calling close_reason()" end |
- (Fixnum) close_status_code
Returns status code of close frame. Only use this for close frames
144 145 146 147 148 149 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 144 def close_status_code if !block_given? return @j_del.java_method(:closeStatusCode, []).call() end raise ArgumentError, "Invalid arguments when calling close_status_code()" end |
- (true, false) continuation?
Returns true if it's a continuation frame
103 104 105 106 107 108 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 103 def continuation? if !block_given? return @j_del.java_method(:isContinuation, []).call() end raise ArgumentError, "Invalid arguments when calling continuation?()" end |
- (true, false) final?
Returns true if this is the final frame.
137 138 139 140 141 142 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 137 def final? if !block_given? return @j_del.java_method(:isFinal, []).call() end raise ArgumentError, "Invalid arguments when calling final?()" end |
- (true, false) text?
Returns true if it's a text frame
89 90 91 92 93 94 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 89 def text? if !block_given? return @j_del.java_method(:isText, []).call() end raise ArgumentError, "Invalid arguments when calling text?()" end |
- (String) text_data
Returns the content of this frame as a UTF-8 string and returns the converted string. Only use this for text frames.
117 118 119 120 121 122 123 124 125 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/web_socket_frame.rb', line 117 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 |