mezon-js 2.7.75 → 2.7.77
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 +6 -6
- package/dist/mezon-js.cjs.js +3 -0
- package/dist/mezon-js.esm.mjs +3 -0
- package/dist/socket.d.ts +3 -0
- package/package.json +1 -1
- package/socket.ts +7 -0
package/README.md
CHANGED
@@ -3,7 +3,7 @@ Mezon JavaScript client
|
|
3
3
|
|
4
4
|
> JavaScript client for Mezon server written in TypeScript. For browser and React Native projects.
|
5
5
|
|
6
|
-
[Mezon](https://github.com/
|
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
7
|
|
8
8
|
This client implements the full API and socket options with the server. It's written in TypeScript with minimal dependencies to be compatible with all modern browsers and React Native.
|
9
9
|
|
@@ -11,7 +11,7 @@ Full documentation is online - https://mezon.vn/docs/javascript-client-guide
|
|
11
11
|
|
12
12
|
## Getting Started
|
13
13
|
|
14
|
-
You'll need to setup the server and database before you can connect with the client. The simplest way is to use Docker but have a look at the [server documentation](https://github.com/
|
14
|
+
You'll need to setup the server and database before you can connect with the client. The simplest way is to use Docker but have a look at the [server documentation](https://github.com/mezon/mezon#getting-started) for other options.
|
15
15
|
|
16
16
|
1. Install and run the servers. Follow these [instructions](https://mezon.vn/docs/install-docker-quickstart).
|
17
17
|
|
@@ -206,12 +206,12 @@ To update the generated Typescript required for using the protocol buffer adapte
|
|
206
206
|
```shell
|
207
207
|
npx protoc \
|
208
208
|
--plugin="./node_modules/.bin/protoc-gen-ts_proto" \
|
209
|
-
--proto_path=$GOPATH/src/github.com/
|
209
|
+
--proto_path=$GOPATH/src/github.com/mezon/mezon-common \
|
210
210
|
--ts_proto_out=. \
|
211
211
|
--ts_proto_opt=snakeToCamel=false \
|
212
212
|
--ts_proto_opt=esModuleInterop=true \
|
213
|
-
$GOPATH/src/github.com/
|
214
|
-
$GOPATH/src/github.com/
|
213
|
+
$GOPATH/src/github.com/mezon/mezon-common/rtapi/realtime.proto \
|
214
|
+
$GOPATH/src/github.com/mezon/mezon-common/api/api.proto
|
215
215
|
```
|
216
216
|
```shell
|
217
217
|
npx protoc --plugin="./node_modules/.bin/protoc-gen-ts_proto.cmd" --proto_path=../../../mezon-common --ts_proto_out=./ --ts_proto_opt=snakeToCamel=false --ts_proto_opt=esModuleInterop=true ../../../mezon-common/rtapi/realtime.proto ../../../mezon-common/api/api.proto
|
@@ -223,7 +223,7 @@ npx protoc --plugin="./node_modules/.bin/protoc-gen-ts_proto.cmd" --proto_path=.
|
|
223
223
|
|
224
224
|
### Release Process
|
225
225
|
|
226
|
-
To release onto NPM if you have access to the "@
|
226
|
+
To release onto NPM if you have access to the "@mezon" organization you can use NPM.
|
227
227
|
|
228
228
|
```shell
|
229
229
|
npm run build --workspace=<workspace> && npm publish --access=public --workspace=<workspace>
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -4432,6 +4432,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4432
4432
|
++this.nextCid;
|
4433
4433
|
return cid;
|
4434
4434
|
}
|
4435
|
+
isOpen() {
|
4436
|
+
return this.adapter.isOpen();
|
4437
|
+
}
|
4435
4438
|
connect(session, createStatus = false, connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs) {
|
4436
4439
|
if (this.adapter.isOpen()) {
|
4437
4440
|
return Promise.resolve(session);
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -4403,6 +4403,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4403
4403
|
++this.nextCid;
|
4404
4404
|
return cid;
|
4405
4405
|
}
|
4406
|
+
isOpen() {
|
4407
|
+
return this.adapter.isOpen();
|
4408
|
+
}
|
4406
4409
|
connect(session, createStatus = false, connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs) {
|
4407
4410
|
if (this.adapter.isOpen()) {
|
4408
4411
|
return Promise.resolve(session);
|
package/dist/socket.d.ts
CHANGED
@@ -399,6 +399,8 @@ interface StatusUpdate {
|
|
399
399
|
}
|
400
400
|
/** A socket connection to Mezon server. */
|
401
401
|
export interface Socket {
|
402
|
+
/** Connection is Open */
|
403
|
+
isOpen(): boolean;
|
402
404
|
/** Connect to the server. */
|
403
405
|
connect(session: Session, createStatus: boolean): Promise<Session>;
|
404
406
|
/** Disconnect from the server. */
|
@@ -502,6 +504,7 @@ export declare class DefaultSocket implements Socket {
|
|
502
504
|
private _heartbeatTimeoutMs;
|
503
505
|
constructor(host: string, port: string, useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number);
|
504
506
|
generatecid(): string;
|
507
|
+
isOpen(): boolean;
|
505
508
|
connect(session: Session, createStatus?: boolean, connectTimeoutMs?: number): Promise<Session>;
|
506
509
|
disconnect(fireDisconnectEvent?: boolean): void;
|
507
510
|
setHeartbeatTimeoutMs(ms: number): void;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -550,6 +550,9 @@ interface StatusUpdate {
|
|
550
550
|
|
551
551
|
/** A socket connection to Mezon server. */
|
552
552
|
export interface Socket {
|
553
|
+
/** Connection is Open */
|
554
|
+
isOpen(): boolean;
|
555
|
+
|
553
556
|
/** Connect to the server. */
|
554
557
|
connect(session: Session, createStatus: boolean): Promise<Session>;
|
555
558
|
|
@@ -718,6 +721,10 @@ export class DefaultSocket implements Socket {
|
|
718
721
|
return cid;
|
719
722
|
}
|
720
723
|
|
724
|
+
isOpen(): boolean {
|
725
|
+
return this.adapter.isOpen();
|
726
|
+
}
|
727
|
+
|
721
728
|
connect(session: Session, createStatus: boolean = false, connectTimeoutMs: number = DefaultSocket.DefaultConnectTimeoutMs): Promise<Session> {
|
722
729
|
if (this.adapter.isOpen()) {
|
723
730
|
return Promise.resolve(session);
|