Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Commit

Permalink
ignore publish message when qos is not 1
Browse files Browse the repository at this point in the history
  • Loading branch information
slashmili committed Jan 18, 2018
1 parent 6bdd1fd commit 6422d74
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/hulaaki/client_tcp_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,27 @@ defmodule Hulaaki.ClientTCPTest do
post_disconnect pid
end

test "on_subscribed_publish_ack with qos 2, should not receive subscribed_publish_ack message", %{client_pid: pid} do
pre_connect pid

options = [topics: ["awesome"], qoses: [1]]
SampleClient.subscribe(pid, options)

spawn fn ->
{:ok, pid2} = SampleClient.start_link(%{parent: self()})

options = [client_id: "another-name-8234", host: TestConfig.mqtt_host, port: TestConfig.mqtt_port]
SampleClient.connect(pid2, options)

options = [topic: "awesome", message: "a message",
dup: 0, qos: 1, retain: 2]
SampleClient.publish(pid2, options)

post_disconnect pid2
end

refute_received {:subscribed_publish_ack, %Message.PubAck{}}

post_disconnect pid
end
end

0 comments on commit 6422d74

Please sign in to comment.