Class: Igniter::Store::NetworkBackend::Subscription
- Inherits:
-
Object
- Object
- Igniter::Store::NetworkBackend::Subscription
- Includes:
- WireProtocol
- Defined in:
- lib/igniter/store/network_backend.rb
Overview
Handle returned by #subscribe. Call #close to unsubscribe.
Constant Summary
Constants included from WireProtocol
WireProtocol::FRAME_CRC_SIZE, WireProtocol::FRAME_HEADER_SIZE
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(socket, thread) ⇒ Subscription
constructor
A new instance of Subscription.
Methods included from WireProtocol
Constructor Details
#initialize(socket, thread) ⇒ Subscription
Returns a new instance of Subscription.
37 38 39 40 |
# File 'lib/igniter/store/network_backend.rb', line 37 def initialize(socket, thread) @socket = socket @thread = thread end |
Instance Method Details
#close ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/igniter/store/network_backend.rb', line 42 def close begin @socket.write(encode_frame(JSON.generate({ op: "close" }))) rescue IOError, Errno::EPIPE, Errno::ECONNRESET nil end @socket.close rescue nil @thread.kill rescue nil end |