Class: VertxWeb::SockJSHandler
- Inherits:
-
Object
- Object
- VertxWeb::SockJSHandler
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/sock_js_handler.rb
Overview
A handler that allows you to handle SockJS connections from clients.
We currently support version 0.3.3 of the SockJS protocol, which can be found in this tag:
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxWeb::SockJSHandler) create(vertx = nil, options = nil)
Create a SockJS handler.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (::VertxWeb::Router) bridge(bridgeOptions = nil) { ... }
Like #bridge but specifying a handler that will receive bridge events.
- - (void) handle(routingContext = nil)
-
- (::VertxWeb::Router) socket_handler { ... }
Set a SockJS socket handler.
Class Method Details
+ (Boolean) accept?(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/sock_js_handler.rb', line 26 def @@j_api_type.accept?(obj) obj.class == SockJSHandler end |
+ (::VertxWeb::SockJSHandler) create(vertx = nil, options = nil)
Create a SockJS handler
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/sock_js_handler.rb', line 45 def self.create(vertx=nil,=nil) if vertx.class.method_defined?(:j_del) && !block_given? && == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandlerSockjs::SockJSHandler.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxWeb::SockJSHandler) elsif vertx.class.method_defined?(:j_del) && .class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandlerSockjs::SockJSHandler.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtWebHandlerSockjs::SockJSHandlerOptions.java_class]).call(vertx.j_del,Java::IoVertxExtWebHandlerSockjs::SockJSHandlerOptions.new(::Vertx::Util::Utils.to_json_object())),::VertxWeb::SockJSHandler) end raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{})" 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/sock_js_handler.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/sock_js_handler.rb', line 38 def self.j_class Java::IoVertxExtWebHandlerSockjs::SockJSHandler.java_class end |
+ (Object) unwrap(obj)
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/sock_js_handler.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/sock_js_handler.rb', line 29 def @@j_api_type.wrap(obj) SockJSHandler.new(obj) end |
Instance Method Details
- (::VertxWeb::Router) bridge(bridgeOptions = nil) { ... }
Like #bridge but specifying a handler
that will receive bridge events.
68 69 70 71 72 73 74 75 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/sock_js_handler.rb', line 68 def bridge(bridgeOptions=nil) if bridgeOptions.class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:bridge, [Java::IoVertxExtWebHandlerSockjs::SockJSBridgeOptions.java_class]).call(Java::IoVertxExtWebHandlerSockjs::SockJSBridgeOptions.new(::Vertx::Util::Utils.to_json_object(bridgeOptions))),::VertxWeb::Router) elsif bridgeOptions.class == Hash && block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:bridge, [Java::IoVertxExtWebHandlerSockjs::SockJSBridgeOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtWebHandlerSockjs::SockJSBridgeOptions.new(::Vertx::Util::Utils.to_json_object(bridgeOptions)),(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::BridgeEvent)) })),::VertxWeb::Router) end raise ArgumentError, "Invalid arguments when calling bridge(#{bridgeOptions})" end |
- (void) handle(routingContext = nil)
This method returns an undefined value.
78 79 80 81 82 83 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/sock_js_handler.rb', line 78 def handle(routingContext=nil) if routingContext.class.method_defined?(:j_del) && !block_given? return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(routingContext.j_del) end raise ArgumentError, "Invalid arguments when calling handle(#{routingContext})" end |
- (::VertxWeb::Router) socket_handler { ... }
Set a SockJS socket handler. This handler will be called with a SockJS socket whenever a SockJS connection
is made from a client
57 58 59 60 61 62 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/sock_js_handler.rb', line 57 def socket_handler if block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:socketHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::SockJSSocket)) })),::VertxWeb::Router) end raise ArgumentError, "Invalid arguments when calling socket_handler()" end |