I have a REST API in go on my server VM, with gorilla/mux:
router := mux.NewRouter().StrictSlash(true)
log.Fatal(http.ListenAndServe(":49186", router))
I have an exposed IP and the domain forwarding set up on Godaddy as: [http://], [198.123.123.123:49186], Forward Type: Permanent (301), Settings: Forward Only
In my Kotlin I have:
val url = "http://example.com/getJSONitem/item%20name"
val q = Volley.newRequestQueue(this)
val request = JsonObjectRequest(Request.Method.Get, url, null, Response.Listener<JSONObject> { response ->
textView.text = response.getString("Name")
},
Response.ErrorListener { error ->
println(error)
})
q.add(request)
When I run this it hangs for a second and I get
I/System.out: com.android.volley.TimeoutError
BUT if I put the IP and port explicitly...
url = "http://198.123.123.123:49186/getJSONitem/item%20name"
...it works and I get my JSON object... At least that tells me that my server is listening. So it is either an issue with my Volley code or I have my DNS forwarding misconfigured, in which case this belongs on SE and I apologize. Thank you for reading.
P.S. I have also tried putting the port after the domain as follows, and receive the same timeout error.
url = "http://example.com:49186/getJSONitem/item%20name"