Class: Tep::BroadcastSubscription
- Inherits:
-
Object
- Object
- Tep::BroadcastSubscription
- Defined in:
- lib/tep/broadcast_subscription.rb
Instance Attribute Summary collapse
-
#fd ⇒ Object
readonly
Integer file descriptor.
-
#mode ⇒ Object
readonly
Delivery mode controls how Tep::Broadcast.publish writes ‘payload` to `fd`:.
-
#topic ⇒ Object
readonly
String.
Instance Method Summary collapse
-
#initialize(topic, fd, mode) ⇒ BroadcastSubscription
constructor
A new instance of BroadcastSubscription.
Constructor Details
#initialize(topic, fd, mode) ⇒ BroadcastSubscription
Returns a new instance of BroadcastSubscription.
36 37 38 39 40 |
# File 'lib/tep/broadcast_subscription.rb', line 36 def initialize(topic, fd, mode) @topic = topic @fd = fd @mode = mode end |
Instance Attribute Details
#fd ⇒ Object (readonly)
Integer file descriptor
22 23 24 |
# File 'lib/tep/broadcast_subscription.rb', line 22 def fd @fd end |
#mode ⇒ Object (readonly)
Delivery mode controls how Tep::Broadcast.publish writes ‘payload` to `fd`:
0 = raw bytes (Sock.sphttp_write_str). The default; suits
SSE / log fan-out / anything that doesn't need framing.
1 = WebSocket TEXT frame (Tep::WebSocket::OPCODE_TEXT).
2 = WebSocket BINARY frame (Tep::WebSocket::OPCODE_BINARY).
Modes 1 and 2 route through Tep::WebSocket::Driver.send_frame, so payloads land as proper WS frames the peer will accept. Apps register mode-1 subscriptions via subscribe_ws.
34 35 36 |
# File 'lib/tep/broadcast_subscription.rb', line 34 def mode @mode end |
#topic ⇒ Object (readonly)
String
21 22 23 |
# File 'lib/tep/broadcast_subscription.rb', line 21 def topic @topic end |