mezon-js-protobuf 1.10.39 → 1.10.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -43
- package/dist/abridged_tcp_adapter.cjs.js +24 -0
- package/dist/abridged_tcp_adapter.d.ts +20 -0
- package/dist/abridged_tcp_adapter.esm.mjs +1 -0
- package/dist/api/api.d.ts +10 -0
- package/dist/index.d.ts +3 -2
- package/dist/mezon-js-protobuf.cjs.js +24 -1
- package/dist/mezon-js-protobuf.esm.mjs +1 -1
- package/dist/mezon-js-protobuf.iife.js +1 -1
- package/dist/rtapi/realtime.d.ts +25 -12
- package/dist/transport_adapter.d.ts +22 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web_socket_adapter.d.ts +18 -0
- package/package.json +59 -54
- package/dist/web_socket_adapter_pb.d.ts +0 -38
package/README.md
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
Mezon JavaScript Protobuf adapter
|
|
2
|
-
========================
|
|
3
|
-
|
|
4
|
-
> Websocket adapter adding protocol buffer support to the [mezon-js](https://www.npmjs.com/package/mezon-js) client.
|
|
5
|
-
|
|
6
|
-
[Mezon](https://github.com/mezon/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](https://mezon.vn).
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Getting Started
|
|
10
|
-
|
|
11
|
-
1. Import the adapter into your project:
|
|
12
|
-
|
|
13
|
-
```shell
|
|
14
|
-
yarn add "mezon-js-protobuf"
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. Pass the Protobuf adapter to build the socket object.
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
import {Client} from "mezon-js";
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
const useSSL = false; // Enable if server is run with an SSL certificate.
|
|
24
|
-
const client = new Client("defaultkey", "127.0.0.1", 7350, useSSL);
|
|
25
|
-
|
|
26
|
-
const trace = false;
|
|
27
|
-
const socket = client.createSocket(useSSL, trace, new
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
3. Use the WebSocket:
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
socket.ondisconnect = (evt) => {
|
|
34
|
-
console.info("Disconnected", evt);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const session = await socket.connect(session);
|
|
38
|
-
// Socket is open.
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### License
|
|
42
|
-
|
|
43
|
-
This project is licensed under the [Apache-2 License](https://github.com/nccasia/mezon-js/blob/master/LICENSE).
|
|
1
|
+
Mezon JavaScript Protobuf adapter
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
> Websocket adapter adding protocol buffer support to the [mezon-js](https://www.npmjs.com/package/mezon-js) client.
|
|
5
|
+
|
|
6
|
+
[Mezon](https://github.com/mezon/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](https://mezon.vn).
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
1. Import the adapter into your project:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
yarn add "mezon-js-protobuf"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. Pass the Protobuf adapter to build the socket object.
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import {Client} from "mezon-js";
|
|
21
|
+
import {WebSocketAdapter} from "mezon-js-protobuf"
|
|
22
|
+
|
|
23
|
+
const useSSL = false; // Enable if server is run with an SSL certificate.
|
|
24
|
+
const client = new Client("defaultkey", "127.0.0.1", 7350, useSSL);
|
|
25
|
+
|
|
26
|
+
const trace = false;
|
|
27
|
+
const socket = client.createSocket(useSSL, trace, new WebSocketAdapter());
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. Use the WebSocket:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
socket.ondisconnect = (evt) => {
|
|
34
|
+
console.info("Disconnected", evt);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const session = await socket.connect(session);
|
|
38
|
+
// Socket is open.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### License
|
|
42
|
+
|
|
43
|
+
This project is licensed under the [Apache-2 License](https://github.com/nccasia/mezon-js/blob/master/LICENSE).
|