A problem with using httpRequest in matchLoop


I need to make requests to the outside at specific stages in my game. I send these requests with nk.httpRequest. These requests can sometimes take 3s and sometimes 5s to return. During this time, matchLoop does not continue and freezes until the requests return. When the requests are answered, it continues again. Is there any other method or scenario I can use to avoid this situation?

Nakama version: 3.17.1
Typescript Runtime

Hey @sinandmr you should be very careful about making any http requests in your match loop. This speaks to a potential design issue in your code. Without knowing what these requests are doing or the design intent of your game, it’s hard to say. You could place the requests in a Goroutine but it’s likely there’s a larger design problem here.

1 Like