I have client code that works fine with Ganache local server, but will it work when I push it to production I mean will Web3.js connect lets say to a BSC rpcUrl network and function like on localhost. Here is sample code am talking about. Am confused cause I see people using Infura and similar providers to connect with the blockchain even Web3.js has Html provider to connect with the chain...why whats the pros, con and limitation is my way ok
let rpcUrl = 'https://bsc-dataseed1.binance.org';
this.web3 = new Web3(rpcUrl);
this.contract = new this.web3.eth.Contract(this.ABI, this.contractAddress);
return this.contract.methods.helloWorld().call().then(result => result);
At the moment, every dApp should provide its own node provider for users. You can piggyback the connection from the MetaMask, but in this case it just likely connects to the same https://bsc-dataseed1.binance.org
URL. Thus, your approach is correct assuming Binance keeps providing RPC URL for free for foreseeable future.
For more options of available Ethereum nodes, please see this website: