Jump to content
alt:V Multiplayer Forum

Asynchronous Remote Procedure Call (altv-rpc)

Recommended Posts

Posted (edited)

Hey there,


I made a remote procedure call system for alt:V named altv-rpc.

altv-rpc offer another way to communicate between different contexts.

In general, it is difficult to send data 'from client to server' or 'browser to server', vice versa and get returned value without creating wrapper or manually calling another event.


With RPC, you can easily call a procedure on server, client or browser and instantly get result asynchronously in your current context like examples below.


you can find more details and download files on github:




in server

import rpc from "yourpathtofile/rpc.mjs"

rpc.register("hello", (args) => {
  console.log('my procedure is call');
  console.log("the caller args =", args);
  return "somebody toucha my baguette"

in client

import rpc from "yourpathtofile/rpc.mjs"

rpc.callServer("hello").then((result) => {
  // result return “somebody toucha my baguette”

// if you want use rpc system in browser, you have to instanciate your view like below
const view = createView('viewName', 'http://resources/url');

in browser

<script type="text/javascript" src="./rpc.browser.mjs"></script>
rpc.callServer("hello", {arg: "what's up"}).then((result) => {
  // result return "somebody toucha my baguette"


You can find more examples and functions on Github link

Please, do not hesitate to let me know if you find any bugs or other things 😊


Edited by Mavdol
  • Like 3

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...