# Can I use multiple runtime modules like Typescript and go in the same project?

**URL:** <https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446>\
**Category:** Runtime Framework\
**Tags:** server-framework, typescript, golang\
**Created:** [October 10, 2023, 11:09am UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446 "2023-10-10T11:09:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anup30giri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/anup30giri/32/1797_2.png) [@Anup30giri](https://forum.heroiclabs.com/u/Anup30giri)\
**Post date:** [October 10, 2023, 11:09am UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/1 "2023-10-10T11:09:59Z")

</div>

> I need to handle player disconnect which only looks possible in go runtime but I was using typescript runtime. So, Can I use multiple runtime modules like Typescript and go in the same project?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [October 10, 2023, 1:49pm UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/2 "2023-10-10T13:49:18Z")

</div>

Hello @Anup30giri,

Yes, you can register functions and match handlers in any of the supported languages. Please be aware that if functions are registered with the same id in multiple runtimes the following preference order takes place: Go \> Lua \> JS.

Best.

---

<div class="post-metadata">

**Author:** ![ezl87](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/ezl87/32/1808_2.png) [@ezl87](https://forum.heroiclabs.com/u/ezl87)\
**Post date:** [October 10, 2023, 2:37pm UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/3 "2023-10-10T14:37:17Z")

</div>

@sesposito sorry to semi-hijack the thread, but I’m trying to achieve the same as OP. What’s the recommended way to deploy multiple modules for different runtimes? I guess copying and pasting the (compiled) module in the data/modules folder as the dockerfiles in the docs do? or are there other methods? I haven’t found anything in the dev console to upload binaries so I guess it can only be done manually

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [October 10, 2023, 2:54pm UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/4 "2023-10-10T14:54:15Z")

</div>

@ezl87 have a look at our [project template](https://github.com/heroiclabs/nakama-project-template), it sets up both TS and Go code in the same project.

---

<div class="post-metadata">

**Author:** ![Anup30giri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/anup30giri/32/1797_2.png) [@Anup30giri](https://forum.heroiclabs.com/u/Anup30giri)\
**Post date:** [October 10, 2023, 4:55pm UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/5 "2023-10-10T16:55:43Z")

</div>

Does the below code address the handling of player disconnects, such as in cases of internet disconnection or when a player closes the game?

```auto
func eventSessionEnd(ctx context.Context, logger runtime.Logger, evt *api.Event) {
	logger.Debug("process event session end: %+v", evt)
}

// noinspection GoUnusedExportedFunction
func InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, initializer runtime.Initializer) error {
	if err := initializer.RegisterEventSessionEnd(eventSessionEnd); err != nil {
		return err
	}
	logger.Info("Go modules loaded.")
	return nil
}

```

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [October 10, 2023, 5:10pm UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/6 "2023-10-10T17:10:32Z")

</div>

Yes it should log a message when a player disconnects.

---

<div class="post-metadata">

**Author:** ![Anup30giri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/anup30giri/32/1797_2.png) [@Anup30giri](https://forum.heroiclabs.com/u/Anup30giri)\
**Post date:** [October 10, 2023, 5:12pm UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/7 "2023-10-10T17:12:14Z")

</div>

yes it works but it’s taking a lot of time

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [October 10, 2023, 5:29pm UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/8 "2023-10-10T17:29:19Z")

</div>

You should have a look at the [socket configurations](https://heroiclabs.com/docs/nakama/getting-started/configuration/#socket.ping_period_ms).

---

<div class="post-metadata">

**Author:** ![Anup30giri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/anup30giri/32/1797_2.png) [@Anup30giri](https://forum.heroiclabs.com/u/Anup30giri)\
**Post date:** [October 10, 2023, 5:30pm UTC](https://forum.heroiclabs.com/t/can-i-use-multiple-runtime-modules-like-typescript-and-go-in-the-same-project/4446/9 "2023-10-10T17:30:48Z")

</div>

Thanks for the help
