mezon-js-protobuf
TypeScript icon, indicating that this package has built-in type declarations

1.4.20 • Public • Published

Mezon JavaScript Protobuf adapter

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

Mezon 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 "@mezon/mezon-js-protobuf"
  2. Pass the Protobuf adapter to build the socket object.

    import {Client} from "@mezon/mezon-js";
    import {WebSocketAdapterPb} from "@mezon/mezon-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.

Package Sidebar

Install

npm i mezon-js-protobuf

Homepage

mezon.vn

Weekly Downloads

305

Version

1.4.20

License

Apache-2.0

Unpacked Size

2.13 MB

Total Files

20

Last publish

Collaborators

  • nguyentrannhan