B4J Question Working with CouchDB continuous feed

Hanz

Active Member
Shalom, bonjour, ni hao, hola, privet, and hello world!!!

I am playing with CouchDB with b4j and it's fun because it's very easy. The server uses http API and so easy to communicate with it using B4J's jOkHttpUtils2. But there is one I'm not getting what I should get. The couchDb's command is:
B4X:
GET /somedatabase/_changes?feed=continuous HTTP/1.1

What the above command does is that it updates or show the newly created record automatically just like in a chat application. It pushes the newly created record instead of pooling. It works with curl command. I use the following code for B4J:

B4X:
Sub Changes
    Dim job As HttpJob
    job.Initialize("", Me)
    
    job.Password = "password"
    job.Username = "admin"
    
    job.Download("http://192.168.1.11:5984/messages/_changes?feed=continuous")
    
    Wait For (job) JobDone(job As HttpJob)

    If job.Success Then
        Log(job.GetString)
        job.Release
    Else
        Log(job.ErrorMessage)
        job.Release
    End If
    
End Sub

I should be getting whatever new record whenever a new one is added from another computer. But it's not. I know it can read the newly added records because if there are none, after a certain number of seconds it drops. But as long as I'm adding new records every few seconds, it keeps running until I stop adding. I am thinking that I should use assync or some kind? Anyone has any idea?
 
Top