Closed alanef closed 8 years ago
Hi @alanef
As you know http.ListenAndServeTLS is an blocking operation ie program halts here to listen and no instructions after that will be run and setwebhook also returns a channel where you can listen for callbacks received check here
I chose the example program to have handling the content of callback channel as main focus coz thats the main aim of the program right! :) , and use a separate goroutine to serve as listener (http.ListenAndServeTLS).
Its just a personal choice to emphasize on the main aim of this library ie to handle the callbacks
Many thanks for taking the time to explain.
I have only been working with Golang for a short while. I have learned a lot reading through your code.
By the way, I how have my test bot working perfectly with your routines, for text, buttons and cards.
Now on to my next task, working out how to call wit.ai effectively from my bot :)
Hi
Is there any reason in your example code you are using a goroutine for the listen?
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", mux)
I have only ever seen using goroutines like this when one program has to listen on multiple ports.
Interest to see why you chose to do this this way?
Alan