diff --git a/RPC-%40-0.2.1.md b/RPC-%40-0.2.1.md index 883f23c..db81002 100644 --- a/RPC-%40-0.2.1.md +++ b/RPC-%40-0.2.1.md @@ -87,7 +87,7 @@ rpc.unregister('playerDamage') ``` ## callClient -Calls a client-side event from server or browser +Calls a client-side event from server or browser (or client, but better use [call](#call)) From browser: ```ts @@ -103,7 +103,7 @@ rpc.callClient(player, 'updatePlayerData', ['argument']).then(response => { ``` ## callServer -Calls a server-side event from browser or client +Calls a server-side event from browser or client (or server, but better use [call](#call)) ```ts rpc.callServer('updatePlayerData', ['argument']).then(response => { console.log(`Received: ${response}`) @@ -111,7 +111,7 @@ rpc.callServer('updatePlayerData', ['argument']).then(response => { ``` ## callBrowser -Calls a server-side event from browser or client +Calls a browser-side event from server or client (or browser, but better use [call](#call)) From client: ```ts @@ -119,7 +119,7 @@ rpc.callBrowser('updatePlayerData', ['argument']).then(response => { console.log(`Received: ${response}`) }) ``` -From client (requires player): +From server (requires player): ```ts rpc.callBrowser(player, 'updatePlayerData', ['argument']).then(response => { console.log(`Received: ${response}`) @@ -139,4 +139,9 @@ These should be clear enough themselves, in other cases refer to here - ``EVENT_NOT_REGISTERED`` - throws in Promise (rejects) in called environment when event is either already unregistered or not registered yet. If you see this its almost always calling an event before registering - ``UNKNOWN_ENVIRONMENT`` - throws in any environment that is not recognized as server/client/browser in Rage. Unlike ``rage-rpc`` this is not thrown in browser when launched without mp context IF you specify it in browser rpc options (see Options) - ``NO_BROWSER`` - throws on client if you failed to specify valid browser for it to refer to when calling browser -- ``EVENT_RESPONSE_TIMEOUT`` - throws in Promise (rejects) when failed to receive a response data from called environment. You may not always want to receive it at all, for now it just works like this. Prefer adding ``catch`` on your events \ No newline at end of file +- ``EVENT_RESPONSE_TIMEOUT`` - throws in Promise (rejects) when failed to receive a response data from called environment. You may not always want to receive it at all, for now it just works like this. Prefer adding ``catch`` on your events + +# License +MIT License + +Copyright (c) 2024 Entity Seven Group \ No newline at end of file