# @heroiclabs/nakama-js-protobuf

> Websocket adapter adding protocol buffer support to the Nakama Javascript client.

Latest version **1.4.0** (published 2023-09-26) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @heroiclabs/nakama-js-protobuf
pnpm add @heroiclabs/nakama-js-protobuf
yarn add @heroiclabs/nakama-js-protobuf
bun add @heroiclabs/nakama-js-protobuf
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2023-09-26 |
| First published | 2020-12-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 220 |
| Author | Chris Molozian |
| Maintainers | heroictom, novabyte, zyro, lugehorsam |
| Keywords | app server, client library, game server, nakama, realtime, realtime chat |

## Links

- npm: https://www.npmjs.com/package/@heroiclabs/nakama-js-protobuf
- Repository: https://github.com/heroiclabs/nakama-js
- Homepage: https://heroiclabs.com
- Issues: https://github.com/heroiclabs/nakama-js/issues
- npm.io page: https://npm.io/package/@heroiclabs/nakama-js-protobuf

## Dependencies (1)

- [@scarf/scarf](https://npm.io/package/@scarf/scarf.md) ^1.1.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.4.0 (latest) — 2023-09-26
- 1.3.0 — 2023-04-03
- 1.2.1 — 2022-06-11
- 1.2.0 — 2022-06-01
- 1.1.0 — 2021-07-12
- 1.0.3 — 2021-01-12
- 1.0.2 — 2021-01-04
- 1.0.1 — 2020-12-09
- 1.0.0 — 2020-12-08

## README

Nakama JavaScript Protobuf adapter
========================

> Websocket adapter adding protocol buffer support to the [nakama-js](https://www.npmjs.com/package/@heroiclabs/nakama-js) client.

[Nakama](https://github.com/heroiclabs/nakama) is an open-source server designed to power modern games and apps. Features include user accounts, chat, social, matchmaker, realtime multiplayer, and much [more](https://heroiclabs.com).


## Getting Started

1. Import the adapter into your project:

    ```shell
    yarn add "@heroiclabs/nakama-js-protobuf"
    ```

2. Pass the Protobuf adapter to build the socket object.

    ```js
    import {Client} from "@heroiclabs/nakama-js";
    import {WebSocketAdapterPb} from "@heroiclabs/nakama-js-protobuf"

    const useSSL = false; // Enable if server is run with an SSL certificate.
    const client = new Client("defaultkey", "127.0.0.1", 7350, useSSL);

    const trace = false;
    const socket = client.createSocket(useSSL, trace, new WebSocketAdapterPb());
    ```

3. Use the WebSocket:

    ```js
    socket.ondisconnect = (evt) => {
        console.info("Disconnected", evt);
    };

    const session = await socket.connect(session);
    // Socket is open.
    ```

### License

This project is licensed under the [Apache-2 License](https://github.com/heroiclabs/nakama-js/blob/master/LICENSE).

---
_Source: https://npm.io/package/@heroiclabs/nakama-js-protobuf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
