Class: Takagi::Network::Tcp
- Defined in:
- lib/takagi/network/tcp.rb
Overview
TCP transport implementation (RFC 8323)
Constant Summary
Constants inherited from Router
Router::DEFAULT_CONTENT_FORMAT
Class Method Summary collapse
- .additional_schemes ⇒ Object
- .default_port ⇒ Object
- .reliable? ⇒ Boolean
- .rfc ⇒ Object
- .scheme ⇒ Object
Instance Method Summary collapse
-
#create_client(options = {}) ⇒ Object
Create TCP client.
-
#create_sender(options = {}) ⇒ Object
Create TCP sender (currently uses existing TcpSender singleton) TODO: Replace with connection pool in Phase 5.
-
#create_server(options = {}) ⇒ Object
Create TCP server.
-
#decode(data) ⇒ Object
Decode TCP stream data into message.
-
#encode(message) ⇒ Object
Encode message for TCP transport (RFC 8323 format).
Methods inherited from Base
Methods included from Base::ServerLifecycle
Methods included from Base::MiddlewareManagement
#call, #middleware_stack, #use
Methods included from Base::ReactorManagement
#reactor, #start_reactors, #stop_reactors, #use_reactor
Methods included from Base::PluginManagement
Methods inherited from Router
#add_route, #all_routes, #configure_core, #find_observable, #find_route, #initialize, instance, #link_format_entries, #observable, reset!
Constructor Details
This class inherits a constructor from Takagi::Router
Class Method Details
.additional_schemes ⇒ Object
14 15 16 |
# File 'lib/takagi/network/tcp.rb', line 14 def self.additional_schemes ['coaps+tcp'] # TLS variant end |
.default_port ⇒ Object
18 19 20 |
# File 'lib/takagi/network/tcp.rb', line 18 def self.default_port 5683 end |
.reliable? ⇒ Boolean
26 27 28 |
# File 'lib/takagi/network/tcp.rb', line 26 def self.reliable? true end |
.rfc ⇒ Object
22 23 24 |
# File 'lib/takagi/network/tcp.rb', line 22 def self.rfc 'RFC 8323' end |
.scheme ⇒ Object
10 11 12 |
# File 'lib/takagi/network/tcp.rb', line 10 def self.scheme 'coap+tcp' end |
Instance Method Details
#create_client(options = {}) ⇒ Object
Create TCP client
54 55 56 57 |
# File 'lib/takagi/network/tcp.rb', line 54 def create_client( = {}) # TcpClient is a separate class :tcp_client end |
#create_sender(options = {}) ⇒ Object
Create TCP sender (currently uses existing TcpSender singleton) TODO: Replace with connection pool in Phase 5
42 43 44 45 |
# File 'lib/takagi/network/tcp.rb', line 42 def create_sender( = {}) require_relative 'tcp_sender' TcpSender.instance end |
#create_server(options = {}) ⇒ Object
Create TCP server
48 49 50 51 |
# File 'lib/takagi/network/tcp.rb', line 48 def create_server( = {}) require_relative '../server/tcp' Server::Tcp.new(**) end |