'Streaming updates with RTK-Query mutation and updating cache

I'm using sockets to allow users to send messages in real-time. I read the RTK-Query documentation and saw an example for a query, where I would be fetching data, as opposed to mutating/sending data.

Is there any difference in implementation between fetching and posting using streaming/sockets? I tried to understand how it works with query, and apply that to mutation, but it didn't exactly work.

I am struggling to get this to work, so any help would be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source