david 0.3.0.pre → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +24 -0
  4. data/Gemfile +11 -7
  5. data/Gemfile.lock +155 -19
  6. data/README.md +21 -3
  7. data/Rakefile +5 -0
  8. data/TODO.md +73 -0
  9. data/benchmarks/Gemfile +4 -0
  10. data/benchmarks/Gemfile.lock +31 -0
  11. data/benchmarks/rps.rb +20 -0
  12. data/bin/david +9 -4
  13. data/config.ru +4 -0
  14. data/david.gemspec +10 -4
  15. data/experiments/mcast.rb +37 -0
  16. data/experiments/structs.rb +45 -0
  17. data/{test.rb → experiments/test.rb} +0 -0
  18. data/lib/david.rb +15 -4
  19. data/lib/david/actor.rb +18 -0
  20. data/lib/david/garbage_collector.rb +35 -0
  21. data/lib/david/observe.rb +102 -0
  22. data/lib/david/rails/action_controller/base.rb +11 -0
  23. data/lib/david/railties/config.rb +20 -1
  24. data/lib/david/railties/middleware.rb +18 -6
  25. data/lib/david/request.rb +80 -0
  26. data/lib/david/resource_discovery.rb +92 -0
  27. data/lib/david/resource_discovery_proxy.rb +13 -0
  28. data/lib/david/server.rb +72 -27
  29. data/lib/david/server/constants.rb +48 -0
  30. data/lib/david/server/deduplication.rb +21 -0
  31. data/lib/david/server/mapping.rb +64 -12
  32. data/lib/david/server/multicast.rb +54 -0
  33. data/lib/david/server/options.rb +32 -0
  34. data/lib/david/server/respond.rb +146 -0
  35. data/lib/david/server/utility.rb +1 -6
  36. data/lib/david/show_exceptions.rb +52 -0
  37. data/lib/david/version.rb +2 -1
  38. data/lib/rack/handler/david.rb +16 -6
  39. data/lib/rack/hello_world.rb +23 -0
  40. data/spec/dummy/Rakefile +6 -0
  41. data/spec/dummy/app/assets/images/.keep +0 -0
  42. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  43. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  44. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  45. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  46. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  47. data/spec/dummy/app/mailers/.keep +0 -0
  48. data/spec/dummy/app/models/.keep +0 -0
  49. data/spec/dummy/app/models/concerns/.keep +0 -0
  50. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  51. data/spec/dummy/bin/bundle +3 -0
  52. data/spec/dummy/bin/rails +4 -0
  53. data/spec/dummy/bin/rake +4 -0
  54. data/spec/dummy/config.ru +4 -0
  55. data/spec/dummy/config/application.rb +29 -0
  56. data/spec/dummy/config/boot.rb +5 -0
  57. data/spec/dummy/config/database.yml +25 -0
  58. data/spec/dummy/config/environment.rb +5 -0
  59. data/spec/dummy/config/environments/development.rb +37 -0
  60. data/spec/dummy/config/environments/production.rb +78 -0
  61. data/spec/dummy/config/environments/test.rb +39 -0
  62. data/spec/dummy/config/initializers/assets.rb +8 -0
  63. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  64. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  65. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  66. data/spec/dummy/config/initializers/inflections.rb +16 -0
  67. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  68. data/spec/dummy/config/initializers/session_store.rb +3 -0
  69. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  70. data/spec/dummy/config/locales/en.yml +23 -0
  71. data/spec/dummy/config/routes.rb +58 -0
  72. data/spec/dummy/config/secrets.yml +22 -0
  73. data/spec/dummy/db/test.sqlite3 +0 -0
  74. data/spec/dummy/lib/assets/.keep +0 -0
  75. data/spec/dummy/log/.keep +0 -0
  76. data/spec/dummy/public/404.html +67 -0
  77. data/spec/dummy/public/422.html +67 -0
  78. data/spec/dummy/public/500.html +66 -0
  79. data/spec/dummy/public/favicon.ico +0 -0
  80. data/spec/guerilla_rack_handler_spec.rb +16 -0
  81. data/spec/mapping_spec.rb +56 -0
  82. data/spec/observe_spec.rb +111 -0
  83. data/spec/perf/server_perf_spec.rb +15 -9
  84. data/spec/resource_discovery_spec.rb +65 -0
  85. data/spec/server_spec.rb +306 -0
  86. data/spec/spec_helper.rb +43 -1
  87. data/spec/utility_spec.rb +8 -0
  88. metadata +195 -38
  89. data/lib/david/server/response.rb +0 -124
  90. data/lib/david/well_known.rb +0 -59
@@ -1,2 +1,44 @@
1
- require_relative '../lib/david'
1
+ # Coveralls
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+ SimpleCov.start { add_filter 'spec/dummy' }
5
+
6
+ # Rails
7
+ ENV['RAILS_ENV'] ||= 'test'
8
+
9
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
10
+ require 'rspec/rails'
11
+
12
+ # David
13
+ $:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
14
+
15
+ require 'david'
16
+
17
+ module David
18
+ module TestHelper
19
+ def debug
20
+ @debug ||= ENV['DEBUG'].nil? ? 'none' : 'debug'
21
+ end
22
+
23
+ def random_port
24
+ rand((2**10+1)..(2**16-1))
25
+ end
26
+
27
+ def supervised_server(options)
28
+ defaults = {
29
+ :Host => '::1',
30
+ :Port => CoAP::PORT,
31
+ :Log => debug
32
+ }
33
+
34
+ defaults[:Multicast] = false if defined?(JRuby)
35
+
36
+ app = options.delete(:app) || Rack::HelloWorld
37
+
38
+ David::Server.supervise_as(:david, app, defaults.merge(options))
39
+ end
40
+ end
41
+ end
42
+
2
43
  include David
44
+ include David::TestHelper
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ include Server::Utility
4
+ describe Server::Utility do
5
+ context 'body_to_string' do
6
+ it { expect(body_to_string(['foo', 'bar', 'baz'])).to eq("foo\r\nbar\r\nbaz") }
7
+ end
8
+ end
metadata CHANGED
@@ -1,71 +1,119 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: david
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.pre
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - henning mueller
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-20 00:00:00.000000000 Z
11
+ date: 2015-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: cbor
14
+ name: celluloid-io
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.16'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.16.1
15
23
  requirement: !ruby/object:Gem::Requirement
16
24
  requirements:
17
- - - "~>"
25
+ - - ~>
18
26
  - !ruby/object:Gem::Version
19
- version: '0.5'
20
- type: :runtime
27
+ version: '0.16'
28
+ - - '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.16.1
21
31
  prerelease: false
32
+ type: :runtime
33
+ - !ruby/object:Gem::Dependency
34
+ name: coap
22
35
  version_requirements: !ruby/object:Gem::Requirement
23
36
  requirements:
24
- - - "~>"
37
+ - - ~>
25
38
  - !ruby/object:Gem::Version
26
- version: '0.5'
27
- - !ruby/object:Gem::Dependency
28
- name: celluloid-io
39
+ version: '0.1'
29
40
  requirement: !ruby/object:Gem::Requirement
30
41
  requirements:
31
- - - "~>"
42
+ - - ~>
32
43
  - !ruby/object:Gem::Version
33
- version: '0.16'
34
- type: :runtime
44
+ version: '0.1'
35
45
  prerelease: false
46
+ type: :runtime
47
+ - !ruby/object:Gem::Dependency
48
+ name: rack
36
49
  version_requirements: !ruby/object:Gem::Requirement
37
50
  requirements:
38
- - - "~>"
51
+ - - ~>
39
52
  - !ruby/object:Gem::Version
40
- version: '0.16'
53
+ version: '1.5'
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ version: '1.5'
59
+ prerelease: false
60
+ type: :runtime
41
61
  - !ruby/object:Gem::Dependency
42
- name: coap
62
+ name: rake
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
43
68
  requirement: !ruby/object:Gem::Requirement
44
69
  requirements:
45
- - - "~>"
70
+ - - '>='
46
71
  - !ruby/object:Gem::Version
47
72
  version: '0'
48
- type: :runtime
49
73
  prerelease: false
74
+ type: :development
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
50
77
  version_requirements: !ruby/object:Gem::Requirement
51
78
  requirements:
52
- - - "~>"
79
+ - - ~>
53
80
  - !ruby/object:Gem::Version
54
- version: '0'
81
+ version: '3.1'
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: '3.1'
87
+ prerelease: false
88
+ type: :development
55
89
  - !ruby/object:Gem::Dependency
56
- name: rack
90
+ name: rspec-rails
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '3.1'
57
96
  requirement: !ruby/object:Gem::Requirement
58
97
  requirements:
59
- - - "~>"
98
+ - - ~>
60
99
  - !ruby/object:Gem::Version
61
- version: '1.5'
62
- type: :runtime
100
+ version: '3.1'
63
101
  prerelease: false
102
+ type: :development
103
+ - !ruby/object:Gem::Dependency
104
+ name: rails
64
105
  version_requirements: !ruby/object:Gem::Requirement
65
106
  requirements:
66
- - - "~>"
107
+ - - ~>
67
108
  - !ruby/object:Gem::Version
68
- version: '1.5'
109
+ version: '4.2'
110
+ requirement: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ~>
113
+ - !ruby/object:Gem::Version
114
+ version: '4.2'
115
+ prerelease: false
116
+ type: :development
69
117
  description: |-
70
118
  David is a CoAP server with Rack interface to bring the
71
119
  illustrious family of Rack compatible web frameworks into the Internet of
@@ -76,56 +124,165 @@ executables:
76
124
  extensions: []
77
125
  extra_rdoc_files: []
78
126
  files:
127
+ - .gitignore
128
+ - .travis.yml
79
129
  - Gemfile
80
130
  - Gemfile.lock
81
131
  - LICENSE
82
132
  - README.md
83
133
  - Rakefile
134
+ - TODO.md
135
+ - benchmarks/Gemfile
136
+ - benchmarks/Gemfile.lock
137
+ - benchmarks/rps.rb
84
138
  - bin/david
85
139
  - config.ru
86
140
  - david.gemspec
141
+ - experiments/mcast.rb
142
+ - experiments/structs.rb
143
+ - experiments/test.rb
87
144
  - lib/david.rb
145
+ - lib/david/actor.rb
146
+ - lib/david/garbage_collector.rb
88
147
  - lib/david/guerilla/rack/handler.rb
148
+ - lib/david/observe.rb
149
+ - lib/david/rails/action_controller/base.rb
89
150
  - lib/david/railties/config.rb
90
151
  - lib/david/railties/middleware.rb
152
+ - lib/david/request.rb
153
+ - lib/david/resource_discovery.rb
154
+ - lib/david/resource_discovery_proxy.rb
91
155
  - lib/david/server.rb
156
+ - lib/david/server/constants.rb
157
+ - lib/david/server/deduplication.rb
92
158
  - lib/david/server/mapping.rb
159
+ - lib/david/server/multicast.rb
93
160
  - lib/david/server/options.rb
94
- - lib/david/server/response.rb
161
+ - lib/david/server/respond.rb
95
162
  - lib/david/server/utility.rb
163
+ - lib/david/show_exceptions.rb
96
164
  - lib/david/version.rb
97
- - lib/david/well_known.rb
98
165
  - lib/rack/handler/coap.rb
99
166
  - lib/rack/handler/david.rb
100
167
  - lib/rack/hello_world.rb
168
+ - spec/dummy/Rakefile
169
+ - spec/dummy/app/assets/images/.keep
170
+ - spec/dummy/app/assets/javascripts/application.js
171
+ - spec/dummy/app/assets/stylesheets/application.css
172
+ - spec/dummy/app/controllers/application_controller.rb
173
+ - spec/dummy/app/controllers/concerns/.keep
174
+ - spec/dummy/app/helpers/application_helper.rb
175
+ - spec/dummy/app/mailers/.keep
176
+ - spec/dummy/app/models/.keep
177
+ - spec/dummy/app/models/concerns/.keep
178
+ - spec/dummy/app/views/layouts/application.html.erb
179
+ - spec/dummy/bin/bundle
180
+ - spec/dummy/bin/rails
181
+ - spec/dummy/bin/rake
182
+ - spec/dummy/config.ru
183
+ - spec/dummy/config/application.rb
184
+ - spec/dummy/config/boot.rb
185
+ - spec/dummy/config/database.yml
186
+ - spec/dummy/config/environment.rb
187
+ - spec/dummy/config/environments/development.rb
188
+ - spec/dummy/config/environments/production.rb
189
+ - spec/dummy/config/environments/test.rb
190
+ - spec/dummy/config/initializers/assets.rb
191
+ - spec/dummy/config/initializers/backtrace_silencers.rb
192
+ - spec/dummy/config/initializers/cookies_serializer.rb
193
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
194
+ - spec/dummy/config/initializers/inflections.rb
195
+ - spec/dummy/config/initializers/mime_types.rb
196
+ - spec/dummy/config/initializers/session_store.rb
197
+ - spec/dummy/config/initializers/wrap_parameters.rb
198
+ - spec/dummy/config/locales/en.yml
199
+ - spec/dummy/config/routes.rb
200
+ - spec/dummy/config/secrets.yml
201
+ - spec/dummy/db/test.sqlite3
202
+ - spec/dummy/lib/assets/.keep
203
+ - spec/dummy/log/.keep
204
+ - spec/dummy/public/404.html
205
+ - spec/dummy/public/422.html
206
+ - spec/dummy/public/500.html
207
+ - spec/dummy/public/favicon.ico
208
+ - spec/guerilla_rack_handler_spec.rb
209
+ - spec/mapping_spec.rb
210
+ - spec/observe_spec.rb
101
211
  - spec/perf/server_perf_spec.rb
212
+ - spec/resource_discovery_spec.rb
213
+ - spec/server_spec.rb
102
214
  - spec/spec_helper.rb
103
- - test.rb
215
+ - spec/utility_spec.rb
104
216
  homepage: https://github.com/nning/david
105
217
  licenses:
106
218
  - GPL-3.0
107
219
  metadata: {}
108
- post_install_message:
220
+ post_install_message:
109
221
  rdoc_options: []
110
222
  require_paths:
111
223
  - lib
112
224
  required_ruby_version: !ruby/object:Gem::Requirement
113
225
  requirements:
114
- - - ">="
226
+ - - '>='
115
227
  - !ruby/object:Gem::Version
116
228
  version: '0'
117
229
  required_rubygems_version: !ruby/object:Gem::Requirement
118
230
  requirements:
119
- - - ">"
231
+ - - '>='
120
232
  - !ruby/object:Gem::Version
121
- version: 1.3.1
233
+ version: '0'
122
234
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.2.2
125
- signing_key:
235
+ rubyforge_project:
236
+ rubygems_version: 2.1.9
237
+ signing_key:
126
238
  specification_version: 4
127
239
  summary: CoAP server with Rack interface.
128
240
  test_files:
241
+ - spec/dummy/Rakefile
242
+ - spec/dummy/app/assets/images/.keep
243
+ - spec/dummy/app/assets/javascripts/application.js
244
+ - spec/dummy/app/assets/stylesheets/application.css
245
+ - spec/dummy/app/controllers/application_controller.rb
246
+ - spec/dummy/app/controllers/concerns/.keep
247
+ - spec/dummy/app/helpers/application_helper.rb
248
+ - spec/dummy/app/mailers/.keep
249
+ - spec/dummy/app/models/.keep
250
+ - spec/dummy/app/models/concerns/.keep
251
+ - spec/dummy/app/views/layouts/application.html.erb
252
+ - spec/dummy/bin/bundle
253
+ - spec/dummy/bin/rails
254
+ - spec/dummy/bin/rake
255
+ - spec/dummy/config.ru
256
+ - spec/dummy/config/application.rb
257
+ - spec/dummy/config/boot.rb
258
+ - spec/dummy/config/database.yml
259
+ - spec/dummy/config/environment.rb
260
+ - spec/dummy/config/environments/development.rb
261
+ - spec/dummy/config/environments/production.rb
262
+ - spec/dummy/config/environments/test.rb
263
+ - spec/dummy/config/initializers/assets.rb
264
+ - spec/dummy/config/initializers/backtrace_silencers.rb
265
+ - spec/dummy/config/initializers/cookies_serializer.rb
266
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
267
+ - spec/dummy/config/initializers/inflections.rb
268
+ - spec/dummy/config/initializers/mime_types.rb
269
+ - spec/dummy/config/initializers/session_store.rb
270
+ - spec/dummy/config/initializers/wrap_parameters.rb
271
+ - spec/dummy/config/locales/en.yml
272
+ - spec/dummy/config/routes.rb
273
+ - spec/dummy/config/secrets.yml
274
+ - spec/dummy/db/test.sqlite3
275
+ - spec/dummy/lib/assets/.keep
276
+ - spec/dummy/log/.keep
277
+ - spec/dummy/public/404.html
278
+ - spec/dummy/public/422.html
279
+ - spec/dummy/public/500.html
280
+ - spec/dummy/public/favicon.ico
281
+ - spec/guerilla_rack_handler_spec.rb
282
+ - spec/mapping_spec.rb
283
+ - spec/observe_spec.rb
129
284
  - spec/perf/server_perf_spec.rb
285
+ - spec/resource_discovery_spec.rb
286
+ - spec/server_spec.rb
130
287
  - spec/spec_helper.rb
131
- has_rdoc:
288
+ - spec/utility_spec.rb
@@ -1,124 +0,0 @@
1
- require 'david/server/mapping'
2
- require 'david/server/utility'
3
-
4
- module David
5
- class Server
6
- module Response
7
- include Mapping
8
- include Utility
9
-
10
- # Freeze some WSGI env keys.
11
- REMOTE_ADDR = 'REMOTE_ADDR'.freeze
12
- REMOTE_PORT = 'REMOTE_PORT'.freeze
13
- REQUEST_METHOD = 'REQUEST_METHOD'.freeze
14
- SCRIPT_NAME = 'SCRIPT_NAME'.freeze
15
- PATH_INFO = 'PATH_INFO'.freeze
16
- QUERY_STRING = 'QUERY_STRING'.freeze
17
- SERVER_NAME = 'SERVER_NAME'.freeze
18
- SERVER_PORT = 'SERVER_PORT'.freeze
19
- CONTENT_LENGTH = 'CONTENT_LENGTH'.freeze
20
- CONTENT_TYPE = 'CONTENT_TYPE'.freeze
21
- HTTP_ACCEPT = 'HTTP_ACCEPT'.freeze
22
-
23
- # Freeze some Rack env keys.
24
- RACK_VERSION = 'rack.version'.freeze
25
- RACK_URL_SCHEME = 'rack.url_scheme'.freeze
26
- RACK_INPUT = 'rack.input'.freeze
27
- RACK_ERRORS = 'rack.errors'.freeze
28
- RACK_MULTITHREAD = 'rack.multithread'.freeze
29
- RACK_MULTIPROCESS = 'rack.multiprocess'.freeze
30
- RACK_RUN_ONCE = 'rack.run_once'.freeze
31
- RACK_LOGGER = 'rack.logger'.freeze
32
-
33
- # Freeze some Rack env values.
34
- EMPTY_STRING = ''.freeze
35
- CONTENT_TYPE_JSON = 'application/json'.freeze
36
- CONTENT_TYPE_CBOR = 'application/cbor'.freeze
37
- RACK_URL_SCHEME_HTTP = 'http'.freeze
38
-
39
- protected
40
-
41
- def respond(host, port, request)
42
- block = CoAP::Block.new(request.options[:block2]).decode
43
- block.size = 1024 if request.options[:block2] == 0
44
-
45
- # Fail if m set.
46
- if block.more
47
- response = initialize_response(request)
48
- response.mcode = 4.05
49
- return response
50
- end
51
-
52
- env = basic_env(host, port, request)
53
- logger.debug env
54
-
55
- code, options, body = @app.call(env)
56
-
57
- ct = content_type(options)
58
- body = body_to_string(body)
59
-
60
- body.close if body.respond_to?(:close)
61
-
62
- if @cbor
63
- body = body_to_cbor(body)
64
- ct = CONTENT_TYPE_CBOR
65
- end
66
-
67
- mcode = http_to_coap_code(code)
68
- etag = etag(options, 4)
69
- cf = CoAP::Registry.convert_content_format(ct)
70
-
71
- response = initialize_response(request)
72
-
73
- response.mcode = mcode
74
- response.payload = block.chunk(body)
75
-
76
- response.options[:etag] = etag
77
- response.options[:content_format] = cf
78
-
79
- block.more = !block.last?(body)
80
-
81
- response.options[:block2] = block.encode
82
-
83
- logger.debug block.inspect
84
-
85
- response
86
- end
87
-
88
- def basic_env(host, port, request)
89
- {
90
- REMOTE_ADDR => host,
91
- REMOTE_PORT => port.to_s,
92
- REQUEST_METHOD => coap_to_http_method(request.mcode),
93
- SCRIPT_NAME => EMPTY_STRING,
94
- PATH_INFO => path_encode(request.options[:uri_path]),
95
- QUERY_STRING => query_encode(request.options[:uri_query])
96
- .gsub(/^\?/, ''),
97
- SERVER_NAME => @host,
98
- SERVER_PORT => @port.to_s,
99
- CONTENT_LENGTH => request.payload.size.to_s,
100
- CONTENT_TYPE => CONTENT_TYPE_JSON,
101
- HTTP_ACCEPT => CONTENT_TYPE_JSON,
102
- RACK_VERSION => [1, 2],
103
- RACK_URL_SCHEME => RACK_URL_SCHEME_HTTP,
104
- RACK_INPUT => StringIO.new(request.payload),
105
- RACK_ERRORS => $stderr,
106
- RACK_MULTITHREAD => true,
107
- RACK_MULTIPROCESS => true,
108
- RACK_RUN_ONCE => false,
109
- RACK_LOGGER => @logger,
110
- }
111
- end
112
-
113
- def initialize_response(request)
114
- type = request.tt == :con ? :ack : :non
115
-
116
- CoAP::Message.new \
117
- tt: type,
118
- mcode: 2.00,
119
- mid: request.mid,
120
- token: request.options[:token]
121
- end
122
- end
123
- end
124
- end