Skip to content
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

Unable to complete forwarding packet to/from client/destination #12

Open
peddamat opened this issue Jan 25, 2023 · 3 comments
Open

Unable to complete forwarding packet to/from client/destination #12

peddamat opened this issue Jan 25, 2023 · 3 comments

Comments

@peddamat
Copy link

Hi, I'm running IOXY using the following:
ioxy mqtts -mqtts-port 8883 -mqtts-cert certs/verificationCert/verificationCert.pem -mqtts-key certs/verificationCert/verificationCert.key broker -mqtt-broker-tls -mqtt-broker-host xxx-xxx.iot.us-west-2.amazonaws.com -mqtt-broker-port 8883 -mqtt-broker-cert certs/aws-iot-certs/xxx.crt -mqtt-broker-key certs/aws-iot-certs/xxx.private.key

Using MQTT Explorer, I can connect to IOXY and subscribe to a topic.

However, when I publish to a topic, I can see IOXY log receipt of the packet, but the packet fails to make it to the AWS IoT console.

When I publish to a topic from the AWS IoT console, I can see IOXY log receipt of the packet, but it too is not forwarded on to MQTT Explorer.

I am not using the GUI as it gets stuck in 'starting...' on my machine.

@peddamat
Copy link
Author

peddamat commented Jan 25, 2023

I was able to step through the code (beautifully written) and find where the issue is primarily occurring.

In mqtt-packet.go's ForwardMQTTPacket() function, the go routine blocks on the wspipe <- b line, if you're not using the GUI.

I commented out the relevant code and was able to receive packets from the AWS IoT into MQTT Explorer, however, the reverse is still throwing errors. Will report back...

func (session *Session) ForwardMQTTPacket ... (
...
case *packets.PublishPacket:
...
  checkError(err)
  wspipe <- b
  addMessage(db, Messages{session.id, p.TopicName, string(p.Payload), p.Dup, int(p.Qos), p.Retain, time.Now().Format("2006-01-02 15:04:05")})
...
}

@peddamat
Copy link
Author

Final update... Setting 'retain' to off in MQTT Explorer fixed the remaining issue. Probably something related to the default policy AWS IoT creates for a Thing.

I'll try to see if there's an elegant solution to the wspipe issue and submit a pull request.

I'm not a Go programmer, so it may take a bit.

Thanks for releasing this code!

@joe199-dot
Copy link

Hello hope you are well, got a question about IOXY first of all I want to thank for this beautiful and amazing work, here is my question I'm trying to connect to my distant broker but there's no way of doing that have you got an idea on how I can connect to the distant broker
Kind regards

peddamat added a commit to peddamat/IOXY that referenced this issue Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants