Closed xtance closed 3 years ago
Hey @xtance do you have any reproducible example? I am using this heavily in a large project with no issues.
One major difference on this version as opposed to RageMP's implementation is that you have to specify a matching namespace in each context.
For example:
const rpc = require('altv-rpc');
rpc.init('myproject');
// now use it freely
rpc.callClient('blahblah').then(console.log);
Oops, sorry it's my bad, I forgot to add webview, probably that was the reason. Can I re-use the same window.rpc after it was set like this? In other .js files in the same "browser"?
<script src="./lib/altv-rpc-browser.js"></script>
<script type="text/javascript">
rpc.init('platee');
</script>
No problem! Glad it worked :)
Yes of course, as long as all rpc calls happen after the namespace has already been set, any file should be able to use that global rpc
instance.
Nice, thanks for response and for this library. I'm going to close issue as the problem was resolved. :з
Works fine in RAGE:MP but not in AltV. Nothing happens when rpc.callClient
Update: the fix is:
rpc.addWebView(browser);
on clientside (as found in updated readme)