-
Notifications
You must be signed in to change notification settings - Fork 9
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
More examples would be good. #1
Comments
Hi Shymega, |
@shymega I just added new docs for the newly released version 0.3.1 - this should solve this issue :) |
@timbuchwaldt Thanks for that, but just wondering - could we add some for GenServer impls, as well? I'm working primarily with GenServer, and it works pretty much the same as the callback, 'xcept I have to run this command in the
Any ideas? |
What does the GenServer do in this case? Can you show a little excerpt from how you use it? |
Sure thing. This is the code behind the MQTT module of my project. (Feel free to poke around!) Without "Process.register/2", the code fails to run, and kills itself. I got the code from your test suite for this project, but I think I'm doing it wrong. WDYT? |
Ah now I get it.. ok, so your are basically using my TestClient - this wasn't quite what I intended users to do. The TestClient is basically just an implementation of the callback interface so I can run unit tests against it.
|
I see. I used that approach /because/ of the lack of documentation. Obviously there's no excuse for my approach now. I'll try using the callback approach.. but ideally, I'd prefer to use a GenServer type solution. Cheers! |
OK, so I tried the callback approach, but I still prefer GenServer. I tried using emqttc directly, but it didn't work the way necessary. It kept timing out and not sending pings to the broker.. Could we add some GenServer examples, for new users? |
+1 GenServer example |
I am thinking of contributing by building a simple example using Exmqttc showing its use with supervisors and GenServer. But I am stuck right at the first step. So, if you can provide any kind of help it'd help us build a go to example for using Exmqttc. In the code
The above code shows the first version which works like a charm.
Things start to break when I add GenServer to take it a step further.
I get following error. Any help regarding where did I go wrong would be appreciated.
I am using mosquitto_sub and mosquitto_pub to test my messages and VerneMQ as the preferred broker. |
Solved the issue. Please check this out and I would love to receive comments about the scope of improvements. How to work with the example?
A slight modification will allow you to add the option of selecting the topic, client details, quality of service etc. |
Just what the title says, tbh. Lack of examples does make it hard to understand.
The text was updated successfully, but these errors were encountered: