Hi, I am getting my feet wet in web-interactivity…so this might be a very basic question.
In the following code the retrieved messages are nicely printed out as a string containing the json information, but my JSON3.read does not work.
using HTTP, JSON3
io = Base.BufferStream()
ch=Channel{Dict}(10)
@async while !eof(io)
bytes = readavailable(io)
println(String(bytes))
put!(ch,JSON3.read(String(bytes)))
end
@async HTTP.request("GET", "https://username:password@bluemix.cloudantnosqldb.appdomain.cloud/test/_changes?feed=continuous&since=now", response_stream=io)
I have also tried to make a version saving the string directly:
io = Base.BufferStream()
ch=Channel{String}(10)
@async while !eof(io)
bytes = readavailable(io)
println(String(bytes))
put!(ch,String(bytes))
end
but this ends up only saving something like "" to ch, while the println still outputs the full json. I realise this may have less with webstack to do than conversion of types but I figured this is where people know how to do it best.
Its a bit hard to do a MWE as I don’t have an open couchDB server to set up at the moment…
Thanks for any pointers!