Fixed request type identification.

This commit is contained in:
imi415 2022-07-31 16:35:02 +08:00
parent 2970c80b83
commit 6b50f08c86
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -73,6 +73,8 @@ begin
next
end
req_params[:type] = wx_cond
# Check cache
api_resp = cache["cache_#{req_params}"]