Change feed- webhooks sync gateway 2.1

Hello,
i’m trying to set a sync gateway web-hook in Nodejs.
Previously i used iriscouch/follow https://github.com/iriscouch/follow package, but i saw that after updating SG to 2.1 community edition, the feed doesn’t work anymore, and every time i save a document, the onFeed callback is not called…
The sync_gateway.json:

{
  "CORS": {
     "Origin":["*"],
     "Headers": ["Content-Type"]
  },
  "admin_interface": ":4985",
  "interface":":4984",
  "databases": {
    "omnitrace_cluster": {
      "bucket": "omnitrace",
      "password": "123123",
      "username": "Administrator",
      "server":"http://127.0.0.1:8091",
      "enable_shared_bucket_access": true,
      "use_views": true,
      "users": {
        "GUEST": {"disabled": false, "admin_channels": ["*"]}
      },
      "sync": `function (doc, oldDoc) {
          channel(doc.channels);
      }`
    }
  }
}

The feed bootstrap file

/*
 * Registering the sync gateway listener
 *
 */
const config = require('../config/database')

const host = config.couchbase.host
const protocol = config.couchbase.protocol
const clusterName = config.couchbase.cluster
const port = config.couchbase.sync_gateway_port

const follow = require('follow')

const opts = {
  db: `${protocol}://${host}:${port}/${clusterName}`,
  include_docs: true,
  since: 'now'
}
const feed = new follow.Feed(opts)

feed.on('change', async (change) => {
  console.log('ok')
//some stuff
})
feed.on('error', async (error) => {
  console.log('Error in couchbase provider sync follow')
  console.log(error)
})

feed.follow()

I saw in the documentation that the right approach is to use either change feed or web-hooks https://docs.couchbase.com/sync-gateway/2.1/server-integration.html.

I was wondering if someone could explain me better the workflow, because the docs are a bit confusing.
In particular, i didn’t understand if the web-socket connection should be made by the server(like iriscouch/follow) or in the client.
Also, for better performance it is recommend to implement change feed hooks rather than webhooks, right?

Thanks in advance

Webhooks are slightly easier to use, however if you have any downtime on the webhook listener you can miss webhooks, and there is no way for Sync Gateway to know that it needs to retry.

With the changes feed, you can pass in your “last known sequence” checkpoint and it will give you all the changes since that sequence.

To use the changes feed, you can use the HTTP REST API directly if you can’t find a library which works well. The REST API is documented here:

https://docs.couchbase.com/sync-gateway/2.1/rest-api.html#/database/get__db___changes

It’s HTTP longpoll based, and so the call will block until new changes show up, or a timeout is reached.

If the docs need more clarification, please post your questions here and I’ll get a docs ticket opened to improve them.

Hello,
i’m very sorry to answer now, but i was very busy and cannot work on that.
I’m trying to use continuous feed. I tried to add this code at the start of my node server:

const axios = require('axios');

// Make a request for a user with a given ID
axios.get('http://localhost:4984/omnitrace_cluster/_changes?style=main_only&active_only=false&include_docs=false&feed=continuous&heartbeat=0&timeout=30000')
  .then(function (response) {
    // handle success
    console.log(response.data)
  })
  .catch(function (error) {
    console.log(error)
  })

In theory if i edit/create a document should increment last_seq and notify the function, but instead every time i change some doc the last_seq is always the same and the server is not notified.

I’m using Couchbase community 6 and SG 2.1 with the settings show above.

What am i doing wrong?