mezon-js 2.7.74 → 2.7.76
Sign up to get free protection for your applications and to get access to all the features.
- 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 +1 -0
- package/package.json +1 -1
- package/socket.ts +4 -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
@@ -502,6 +502,7 @@ export declare class DefaultSocket implements Socket {
|
|
502
502
|
private _heartbeatTimeoutMs;
|
503
503
|
constructor(host: string, port: string, useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number);
|
504
504
|
generatecid(): string;
|
505
|
+
isOpen(): boolean;
|
505
506
|
connect(session: Session, createStatus?: boolean, connectTimeoutMs?: number): Promise<Session>;
|
506
507
|
disconnect(fireDisconnectEvent?: boolean): void;
|
507
508
|
setHeartbeatTimeoutMs(ms: number): void;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -718,6 +718,10 @@ export class DefaultSocket implements Socket {
|
|
718
718
|
return cid;
|
719
719
|
}
|
720
720
|
|
721
|
+
isOpen(): boolean {
|
722
|
+
return this.adapter.isOpen();
|
723
|
+
}
|
724
|
+
|
721
725
|
connect(session: Session, createStatus: boolean = false, connectTimeoutMs: number = DefaultSocket.DefaultConnectTimeoutMs): Promise<Session> {
|
722
726
|
if (this.adapter.isOpen()) {
|
723
727
|
return Promise.resolve(session);
|