diff --git a/src/client.rb b/src/client.rb index cbcf8a4..0531038 100644 --- a/src/client.rb +++ b/src/client.rb @@ -25,10 +25,12 @@ begin client.subscribe('iot/weather/testclient/response') client.publish('iot/weather/testclient/request', { type: 'condition', city_id: 10 }.to_cbor) + client.publish('iot/weather/testclient/request', { type: 'aqi', city_id: 10 }.to_cbor) + client.publish('iot/weather/testclient/request', { type: 'forecast24', city_id: 10 }.to_cbor) - _, payload = client.get - p CBOR.decode(payload) - + client.get do |_, payload| + p CBOR.decode(payload) + end rescue SystemExit, Interrupt puts "Interrupt caught, client [#{client}] disconnect." client.disconnect diff --git a/src/server.rb b/src/server.rb index 5209ddb..e827858 100644 --- a/src/server.rb +++ b/src/server.rb @@ -73,6 +73,8 @@ begin next end + req_params[:type] = wx_cond + # Check cache api_resp = cache["cache_#{req_params}"]