1.4.0 • Published 7 months ago

@heroiclabs/nakama-js-protobuf v1.4.0

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
7 months ago

Nakama JavaScript Protobuf adapter

Websocket adapter adding protocol buffer support to the nakama-js client.

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.

Getting Started

  1. Import the adapter into your project:

    yarn add "@heroiclabs/nakama-js-protobuf"
  2. Pass the Protobuf adapter to build the socket object.

    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:

    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.

1.4.0

7 months ago

1.3.0

1 year ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago