@vworlds/dgram-client 1.0.6 → 1.0.8
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/node_modules/@vworlds/dgram-common/package.json +11 -0
- package/node_modules/@vworlds/dgram-common/src/constants.d.ts +18 -0
- package/node_modules/@vworlds/dgram-common/src/constants.js +19 -0
- package/node_modules/@vworlds/dgram-common/src/constants.js.map +1 -0
- package/node_modules/@vworlds/dgram-common/src/index.d.ts +3 -0
- package/node_modules/@vworlds/dgram-common/src/index.js +3 -0
- package/node_modules/@vworlds/dgram-common/src/index.js.map +1 -0
- package/node_modules/@vworlds/dgram-common/src/socket.d.ts +27 -0
- package/node_modules/@vworlds/dgram-common/src/socket.js +5 -0
- package/node_modules/@vworlds/dgram-common/src/socket.js.map +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const EVENTS: {
|
|
2
|
+
CONNECT: string;
|
|
3
|
+
CONNECTION: string;
|
|
4
|
+
DATA_CHANNEL_IS_OPEN: string;
|
|
5
|
+
DISCONNECTED: string;
|
|
6
|
+
ERROR: string;
|
|
7
|
+
MESSAGE: string;
|
|
8
|
+
};
|
|
9
|
+
declare const ERRORS: {
|
|
10
|
+
BROWSER_NOT_SUPPORTED: string;
|
|
11
|
+
COULD_NOT_PARSE_MESSAGE: string;
|
|
12
|
+
DROPPED_FROM_BUFFERING: string;
|
|
13
|
+
MAX_MESSAGE_SIZE_EXCEEDED: string;
|
|
14
|
+
PEER_CONNECTION_NOT_CREATED: string;
|
|
15
|
+
DATA_CHANNEL_NOT_CREATED: string;
|
|
16
|
+
CONNECTION_CLOSED: string;
|
|
17
|
+
};
|
|
18
|
+
export { EVENTS, ERRORS };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const EVENTS = {
|
|
2
|
+
CONNECT: 'connect',
|
|
3
|
+
CONNECTION: 'connection',
|
|
4
|
+
DATA_CHANNEL_IS_OPEN: 'dataChannelIsOpen',
|
|
5
|
+
DISCONNECTED: 'disconnected',
|
|
6
|
+
ERROR: 'error',
|
|
7
|
+
MESSAGE: 'rawMessage',
|
|
8
|
+
};
|
|
9
|
+
const ERRORS = {
|
|
10
|
+
BROWSER_NOT_SUPPORTED: 'BROWSER_NOT_SUPPORTED',
|
|
11
|
+
COULD_NOT_PARSE_MESSAGE: 'COULD_NOT_PARSE_MESSAGE',
|
|
12
|
+
DROPPED_FROM_BUFFERING: 'DROPPED_FROM_BUFFERING',
|
|
13
|
+
MAX_MESSAGE_SIZE_EXCEEDED: 'MAX_MESSAGE_SIZE_EXCEEDED',
|
|
14
|
+
PEER_CONNECTION_NOT_CREATED: 'PEER_CONNECTION_NOT_CREATED',
|
|
15
|
+
DATA_CHANNEL_NOT_CREATED: 'DATA_CHANNEL_NOT_CREATED',
|
|
16
|
+
CONNECTION_CLOSED: 'CONNECTION_CLOSED',
|
|
17
|
+
};
|
|
18
|
+
export { EVENTS, ERRORS };
|
|
19
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../dgram-common/src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;IACxB,oBAAoB,EAAE,mBAAmB;IACzC,YAAY,EAAE,cAAc;IAC5B,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,MAAM,MAAM,GAAG;IACb,qBAAqB,EAAE,uBAAuB;IAC9C,uBAAuB,EAAE,yBAAyB;IAClD,sBAAsB,EAAE,wBAAwB;IAChD,yBAAyB,EAAE,2BAA2B;IACtD,2BAA2B,EAAE,6BAA6B;IAC1D,wBAAwB,EAAE,0BAA0B;IACpD,iBAAiB,EAAE,mBAAmB;CACvC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dgram-common/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
/** Describes a connection failure reported through the socket `connect` event. */
|
|
3
|
+
export interface ConnectionError extends Error {
|
|
4
|
+
/** Numeric status code for the failure. Browser support failures use `-1`. */
|
|
5
|
+
status: number;
|
|
6
|
+
/** Human-readable status text suitable for logs or UI. */
|
|
7
|
+
statusText: string;
|
|
8
|
+
}
|
|
9
|
+
/** Events emitted by dgram socket implementations. */
|
|
10
|
+
interface SocketEvents {
|
|
11
|
+
/** Fired after the peer connection or data channel closes. */
|
|
12
|
+
disconnect: () => void;
|
|
13
|
+
/** Fired when binary payload data arrives from the remote peer. */
|
|
14
|
+
receive: (data: Uint8Array) => void;
|
|
15
|
+
/** Fired when the socket connects, or with an error when setup fails. */
|
|
16
|
+
connect: (err?: ConnectionError) => void;
|
|
17
|
+
}
|
|
18
|
+
/** Common socket-shaped interface implemented by browser and server dgram sockets. */
|
|
19
|
+
export declare abstract class Socket extends EventEmitter<SocketEvents> {
|
|
20
|
+
/** Stable connection id assigned by the signaling server. */
|
|
21
|
+
abstract get id(): string;
|
|
22
|
+
/** Sends one binary datagram-like payload over the underlying WebRTC data channel. */
|
|
23
|
+
abstract send(data: Uint8Array): void;
|
|
24
|
+
/** Closes the underlying WebRTC connection and releases resources. */
|
|
25
|
+
abstract close(): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../../dgram-common/src/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAoB7C,sFAAsF;AACtF,MAAM,OAAgB,MAAO,SAAQ,YAA0B;CAO9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vworlds/dgram-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dgram-client/src/index.js",
|
|
6
6
|
"types": "./dgram-client/src/index.d.ts",
|
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
"url": "https://github.com/vworlds/dgram"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@vworlds/dgram-common": "
|
|
18
|
+
"@vworlds/dgram-common": "1.0.8",
|
|
19
19
|
"eventemitter3": "^5.0.4"
|
|
20
20
|
},
|
|
21
|
+
"bundledDependencies": [
|
|
22
|
+
"@vworlds/dgram-common"
|
|
23
|
+
],
|
|
21
24
|
"license": "UNLICENSED"
|
|
22
25
|
}
|