I am making a dApp where in for login purpose I access metamask account to which user is logged in. I also have a back end server that listens to events emitted by the smart contract that updates data in an off-chain database.
Now, I plan to deploy my dApp to Rinkeby network for next level of testing. To listen to events on Rinkeby network I am using Infura websockets:
var web3 = new Web3("wss://rinkeby.infura.io/_ws");
But this has caused me problem. With the above web3 setting the dApp is unable to detect metamask (is locked or not) and the user account which is logged in.
I am stuck here as in I want to access the user account which is logged in Metamask and also want to use Infura Websockets to listen to events. But it looks like I can set only either of them as web3 provider.
Please suggest how can I circumvent this problem.