Class: Vertx::WebSocket
- Inherits:
-
Object
- Object
- Vertx::WebSocket
- Includes:
- ReadStream, WriteStream
- Defined in:
- src/main/ruby_scripts/core/http.rb
Overview
Encapsulates an HTML 5 Websocket.
Instances of this class are createde by an HttpClient instance when a client succeeds in a websocket handshake with a server. Once an instance has been obtained it can be used to send or receive buffers of data from the connection, a bit like a TCP socket.
Direct Known Subclasses
Instance Method Summary (collapse)
-
- (Object) binary_handler_id
When a Websocket is created it automatically registers an event handler with the system, the ID of that handler is given by #binary_handler_id.
-
- (Object) close
Close the websocket.
-
- (Object) closed_handler(proc = nil, &hndlr)
Set a closed handler on the websocket.
-
- (Object) text_handler_id
When a Websocket is created it automatically registers an event handler with the system, the ID of that handler is given by #text_handler_id.
-
- (Object) write_binary_frame(buffer)
Write data to the websocket as a binary frame.
-
- (Object) write_text_frame(str)
Write data to the websocket as a text frame.
Methods included from ReadStream
#data_handler, #end_handler, #exception_handler, #pause, #resume
Methods included from WriteStream
#drain_handler, #exception_handler, #write_buffer, #write_queue_full?, #write_queue_max_size=
Instance Method Details
- (Object) binary_handler_id
When a Websocket is created it automatically registers an event handler with the system, the ID of that handler is given by #binary_handler_id. Given this ID, a different event loop can send a binary frame to that event handler using the event bus. This allows you to write data to other websockets which are owned by different event loops.
719 720 721 |
# File 'src/main/ruby_scripts/core/http.rb', line 719 def binary_handler_id @binary_handler_id end |
- (Object) close
Close the websocket
711 712 713 |
# File 'src/main/ruby_scripts/core/http.rb', line 711 def close @j_del.close end |
- (Object) closed_handler(proc = nil, &hndlr)
Set a closed handler on the websocket.
734 735 736 737 |
# File 'src/main/ruby_scripts/core/http.rb', line 734 def closed_handler(proc = nil, &hndlr) hndlr = proc if proc @closed_handler = hndlr end |
- (Object) text_handler_id
When a Websocket is created it automatically registers an event handler with the system, the ID of that handler is given by #text_handler_id. Given this ID, a different event loop can send a text frame to that event handler using the event bus. This allows you to write data to other websockets which are owned by different event loops.
727 728 729 |
# File 'src/main/ruby_scripts/core/http.rb', line 727 def text_handler_id @text_handler_id end |
- (Object) write_binary_frame(buffer)
Write data to the websocket as a binary frame
700 701 702 |
# File 'src/main/ruby_scripts/core/http.rb', line 700 def write_binary_frame(buffer) @j_del.writeBinaryFrame(buffer._to_java_buffer) end |
- (Object) write_text_frame(str)
Write data to the websocket as a text frame
706 707 708 |
# File 'src/main/ruby_scripts/core/http.rb', line 706 def write_text_frame(str) @j_del.writeTextFrame(str) end |