# Function: handleGameWorkerMessage() (/pixi-vn/index/functions/handleGameWorkerMessage)



\> **handleGameWorkerMessage**(`request`): `Promise`\<[`GameWorkerResponse`](/pixi-vn/index/type-aliases/GameWorkerResponse)>

Defined in: [src/worker/handleGameWorkerMessage.ts:26](https://github.com/DRincs-Productions/pixi-vn/blob/5bb5bb1f92e38998ea2f477b600168d8da3ece19/src/worker/handleGameWorkerMessage.ts#L26)

The worker-side half of the [GameWorkerManager](/pixi-vn/index/classes/GameWorkerManager) protocol. The game project creates its
own Worker (so it controls the bundler-specific setup) and points its `message` handling here:

```ts
// game-worker.ts, built as its own entry by the project's bundler
import { handleGameWorkerMessage } from "@drincs/pixi-vn/worker";

self.onmessage = async (event) => {
    const response = await handleGameWorkerMessage(event.data);
    if (response) self.postMessage(response);
};
```

A third-party library sharing this same worker (see `registerGameWorkerHandler`) just needs
its own worker-side registration module imported alongside this one, in that same file.

Everything this processes is plain, structured-clone-safe data by construction - it never
touches PixiJS/canvas/audio, which only exist on the main thread.

## Parameters [#parameters]

### request [#request]

[`GameWorkerRequest`](/pixi-vn/index/type-aliases/GameWorkerRequest)

## Returns [#returns]

`Promise`\<[`GameWorkerResponse`](/pixi-vn/index/type-aliases/GameWorkerResponse)>
