-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emqttc bug #11
Comments
we met the similar issue in our project as well. When we change to erlmqtt, it is doing well. If I have some time, I would help to investigate this issue. It may be relevant to the parse or serialize part of your code. |
@witeman, duplicated message? could you reoccure the issue? Could send me your code by email: [email protected] |
You can send any payload(publish) of size more than 2.5k, then the second coming payload would become different between publisher's sending and subscriber's receiving. |
okay, I will try it now |
@witeman I use emqttd_benchmak to send/receive:
It works well |
the size is the same but content differs. I guess that problem lies at emqttc_parser:parse BR
|
Reproduce steps:
So I guess the problem is caused by the emqttc_parser:parse/2. |
@witeman what's the fuck stupid bug! Forgot to reinit the parser after a frame is parsed successfully! Thx for your help, I fix this issue now. src/emqttc_socket.erl:
|
Hope you are doing well. We are using emqttc in our application and are facing errors in receive block. Some of the messages are completely jumbled and dirty payload buffer. Also the message with error keeps repeating (emqttc keeps publishing the same message).
We are using it in Elixir Genserver. The relevant blocks are as follows
Genserver handle_info to receive publish events
def handle_info({:publish, channel,message}, %{client: client, chan: chan}) do
spawn fn -> mqtt_receive(channel,message,chan) end
{:noreply, %{client: client, chan: chan}}
end
defp mqtt_receive(channel,payload,chan) do
[_|values] = String.split(channel,"/")
[service|[iris_id|[request|[]]]] = values
try do
case JSON.decode(payload) do
{:ok,message} ->
payload = %{message: message}
case JSON.encode(payload) do
{:ok,jsonpayload} ->
####
:ok
{:error,msg} ->
IO.puts "Encode Error: #{msg}"
end
{:error,err} ->
IO.puts "Error: #{err}"
end
rescue
exception ->
IO.puts "Error while decoding json from mosca"
:ok
end
end
The text was updated successfully, but these errors were encountered: