What is topics?

What is topics? I understood is used to filter the received response from websocket, it that right?

  • topics [optional] - Array of 32 Bytes DATA topics.

Topics are order-dependent. A note on specifying topic filters: Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:

  • [] - anything"
  • [A] - A in first position (and anything after)
  • [null, B] - anything in first position AND B in second position (and anything after)
  • [A, B] - A in first position AND B in second position (and anything after)"
  • [[A, B], [A, B]] - (A OR B) in first position AND (A OR B) in second position (and anything after)

Correct it is used to filter the Ethereum events from new blocks to only the ones your app cares about. This is a good primer that explains it: https://codeburst.io/deep-dive-into-ethereum-logs-a8d2047c7371