# How to call a registered RPC method from a Match, server-side (in Typescript)

**URL:** <https://forum.heroiclabs.com/t/how-to-call-a-registered-rpc-method-from-a-match-server-side-in-typescript/3083>\
**Category:** Runtime Framework\
**Tags:** server-framework, typescript\
**Created:** [September 26, 2022, 4:47pm UTC](https://forum.heroiclabs.com/t/how-to-call-a-registered-rpc-method-from-a-match-server-side-in-typescript/3083 "2022-09-26T16:47:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raid](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/raid/32/1333_2.png) [@Raid](https://forum.heroiclabs.com/u/Raid)\
**Post date:** [September 26, 2022, 4:47pm UTC](https://forum.heroiclabs.com/t/how-to-call-a-registered-rpc-method-from-a-match-server-side-in-typescript/3083/1 "2022-09-26T16:47:53Z")

</div>

1. Versions: Nakama 3.13.1, Docker
2. Server Framework Runtime language TS/JS

Hello, I was wondering if it was at all possible to call a “server-to-server” RPC from within the server itself. In this case, as soon as the match is over, I want to make a call to some shared functionality that’s currently registered via an RPC, however I’m having a really difficult time finding a way to access said RPC. I’ve looked around the `nk: nkruntime.Nakama`, `ctx: nkruntime.Context`, and `dispatcher: nkruntime.MatchDispatcher`, but there seems to be no way to directly call the RPC.

I suppose something like a `fetch` call to `127.0.0.1:7350/v2/rpc`, could be used, but it’ll require some authentication and such. Feels like really bad way to do it from the server itself.

I’ve been pulling my hair out over this, it feels like I’m missing something obvious. Any help or pointing in the correct direction would be really appreciated.

---

<div class="post-metadata">

**Author:** ![lugehorsam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/lugehorsam/32/314_2.png) [@lugehorsam](https://forum.heroiclabs.com/u/lugehorsam)\
**Post date:** [September 26, 2022, 7:28pm UTC](https://forum.heroiclabs.com/t/how-to-call-a-registered-rpc-method-from-a-match-server-side-in-typescript/3083/2 "2022-09-26T19:28:00Z")

</div>

Hey @Raid why not just call what would be the RPC as a regular Go function? The client can call the RPC, and the server can just invoke the function.

---

<div class="post-metadata">

**Author:** ![Raid](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/raid/32/1333_2.png) [@Raid](https://forum.heroiclabs.com/u/Raid)\
**Post date:** [September 30, 2022, 9:55pm UTC](https://forum.heroiclabs.com/t/how-to-call-a-registered-rpc-method-from-a-match-server-side-in-typescript/3083/3 "2022-09-30T21:55:03Z")

</div>

This is what I ended up doing! There seems to be some limitations to which type of objects can be registered as a Match (in TypeScript), and I thought it’d be similar for RPC calls. But I figured it’d be easier to access the registered RPC methods, seeing that they get some context and such injected. It’s not a big issue or anything, just something I was wondering about. This’ll work fine for now. Thanks for the suggestion!
