Class: Takagi::Network::Udp
- Defined in:
- lib/takagi/network/udp.rb
Overview
UDP transport implementation (RFC 7252)
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 UDP client (internal UdpClient class from client.rb).
-
#create_sender(options = {}) ⇒ Object
Create UDP sender.
-
#create_server(options = {}) ⇒ Object
Create UDP server.
-
#decode(data) ⇒ Object
Decode UDP datagram into message.
-
#encode(message) ⇒ Object
Encode message for UDP transport (RFC 7252 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/udp.rb', line 14 def self.additional_schemes ['coaps'] # DTLS variant end |
.default_port ⇒ Object
18 19 20 |
# File 'lib/takagi/network/udp.rb', line 18 def self.default_port 5683 end |
.reliable? ⇒ Boolean
26 27 28 |
# File 'lib/takagi/network/udp.rb', line 26 def self.reliable? false end |
.rfc ⇒ Object
22 23 24 |
# File 'lib/takagi/network/udp.rb', line 22 def self.rfc 'RFC 7252' end |
.scheme ⇒ Object
10 11 12 |
# File 'lib/takagi/network/udp.rb', line 10 def self.scheme 'coap' end |
Instance Method Details
#create_client(options = {}) ⇒ Object
Create UDP client (internal UdpClient class from client.rb)
53 54 55 56 57 58 |
# File 'lib/takagi/network/udp.rb', line 53 def create_client( = {}) # UdpClient is defined inside client.rb # We'll return the class reference for now # The actual instantiation happens in Client :udp_client end |
#create_sender(options = {}) ⇒ Object
Create UDP sender
41 42 43 44 |
# File 'lib/takagi/network/udp.rb', line 41 def create_sender( = {}) require_relative 'udp_sender' UdpSender.instance end |
#create_server(options = {}) ⇒ Object
Create UDP server
47 48 49 50 |
# File 'lib/takagi/network/udp.rb', line 47 def create_server( = {}) require_relative '../server/udp' Server::Udp.new(**) end |