@deeptrekker/api-channels 0.8.0 → 0.8.1-testingconnectionfix.1
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/dist/constants/index.d.ts +40 -40
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/channels/index.d.ts +9 -9
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/signalR/index.d.ts +13 -13
- package/dist/lib/webRTC/index.d.ts +12 -12
- package/dist/types/index.d.ts +112 -112
- package/package.json +5 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ConfigProperties, ConnectionSettings, WebRtcOptions } from "@types";
|
|
2
|
-
/**
|
|
3
|
-
* Establish Full Connection
|
|
4
|
-
*
|
|
5
|
-
* Sets up the {@link HubConnection} and then initializes the {@link RTCPeerConnection}.
|
|
6
|
-
* @param connectionSettings {@link ConnectionSettings}
|
|
7
|
-
* @param callbacks {@link WebRtcOptions}
|
|
8
|
-
*/
|
|
9
|
-
export declare const establishFullConnection: (connectionSettings: ConnectionSettings, callbacks: WebRtcOptions, configProperties?: ConfigProperties) => Promise<void>;
|
|
1
|
+
import { ConfigProperties, ConnectionSettings, WebRtcOptions } from "@types";
|
|
2
|
+
/**
|
|
3
|
+
* Establish Full Connection
|
|
4
|
+
*
|
|
5
|
+
* Sets up the {@link HubConnection} and then initializes the {@link RTCPeerConnection}.
|
|
6
|
+
* @param connectionSettings {@link ConnectionSettings}
|
|
7
|
+
* @param callbacks {@link WebRtcOptions}
|
|
8
|
+
*/
|
|
9
|
+
export declare const establishFullConnection: (connectionSettings: ConnectionSettings, callbacks: WebRtcOptions, configProperties?: ConfigProperties) => Promise<void>;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./channels";
|
|
2
|
-
export * from "./signalR";
|
|
3
|
-
export * from "./webRTC";
|
|
1
|
+
export * from "./channels";
|
|
2
|
+
export * from "./signalR";
|
|
3
|
+
export * from "./webRTC";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { HubConnection } from "@microsoft/signalr";
|
|
2
|
-
import { ConfigProperties, ConnectionSettings } from "@types";
|
|
3
|
-
export declare const getTime: () => string;
|
|
4
|
-
/**
|
|
5
|
-
* Connect to Server
|
|
6
|
-
*
|
|
7
|
-
* Attempts to connect to the signaling server
|
|
8
|
-
* @param onConnectionSuccess The callback provided that returns the connected {@link HubConnection}
|
|
9
|
-
* @param connectionSettings {@link ConnectionSettings} The provided connection settings used to determine what signaling server to connect other similar settings
|
|
10
|
-
* @returns void
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export declare const connectToServer: (onConnectionSuccess: (socket: HubConnection) => void, connectionSettings: ConnectionSettings, configProperties: ConfigProperties) => Promise<void>;
|
|
1
|
+
import { HubConnection } from "@microsoft/signalr";
|
|
2
|
+
import { ConfigProperties, ConnectionSettings } from "@types";
|
|
3
|
+
export declare const getTime: () => string;
|
|
4
|
+
/**
|
|
5
|
+
* Connect to Server
|
|
6
|
+
*
|
|
7
|
+
* Attempts to connect to the signaling server
|
|
8
|
+
* @param onConnectionSuccess The callback provided that returns the connected {@link HubConnection}
|
|
9
|
+
* @param connectionSettings {@link ConnectionSettings} The provided connection settings used to determine what signaling server to connect other similar settings
|
|
10
|
+
* @returns void
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare const connectToServer: (onConnectionSuccess: (socket: HubConnection) => void, connectionSettings: ConnectionSettings, configProperties: ConfigProperties) => Promise<void>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { HubConnection } from "@microsoft/signalr";
|
|
2
|
-
import { ConfigProperties, WebRtcOptions } from "@types";
|
|
3
|
-
export declare const peerConnections: Record<string, RTCPeerConnection | null>;
|
|
4
|
-
export declare const closeAllPeerConnections: () => void;
|
|
5
|
-
/**
|
|
6
|
-
* Initialize WebRTC
|
|
7
|
-
*
|
|
8
|
-
* Negotiates a {@link RTCPeerConnection} with the provided {@link HubConnection} and relays information through the provided callbacks
|
|
9
|
-
* @param socketRef The SignalR hub connection that will be used to negotiate the WebRTC connection
|
|
10
|
-
* @param callbacks The grouping of callbacks that will return important information to the frontend
|
|
11
|
-
*/
|
|
12
|
-
export declare const initializeWebRTC: (socketRef: HubConnection, callbacks: WebRtcOptions, configProperties: ConfigProperties) => void;
|
|
1
|
+
import { HubConnection } from "@microsoft/signalr";
|
|
2
|
+
import { ConfigProperties, WebRtcOptions } from "@types";
|
|
3
|
+
export declare const peerConnections: Record<string, RTCPeerConnection | null>;
|
|
4
|
+
export declare const closeAllPeerConnections: () => void;
|
|
5
|
+
/**
|
|
6
|
+
* Initialize WebRTC
|
|
7
|
+
*
|
|
8
|
+
* Negotiates a {@link RTCPeerConnection} with the provided {@link HubConnection} and relays information through the provided callbacks
|
|
9
|
+
* @param socketRef The SignalR hub connection that will be used to negotiate the WebRTC connection
|
|
10
|
+
* @param callbacks The grouping of callbacks that will return important information to the frontend
|
|
11
|
+
*/
|
|
12
|
+
export declare const initializeWebRTC: (socketRef: HubConnection, callbacks: WebRtcOptions, configProperties: ConfigProperties) => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
import { HubConnection, LogLevel } from "@microsoft/signalr";
|
|
2
|
-
/**
|
|
3
|
-
* Answer Event
|
|
4
|
-
*
|
|
5
|
-
* An event triggered during the signaling process
|
|
6
|
-
* @property {@link RTCSessionDescription} sdp: The session description protocol object. See WebRTC documentation for more details
|
|
7
|
-
*/
|
|
8
|
-
export type AnswerEvent = {
|
|
9
|
-
sdp: RTCSessionDescription;
|
|
10
|
-
caller: string;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Client
|
|
14
|
-
*
|
|
15
|
-
* A structure used for the signaling mechanism to identify connected users
|
|
16
|
-
*
|
|
17
|
-
* @property {@link string} client_id: The human-readable name that a client provides to the signaling server
|
|
18
|
-
* @property {@link string} connection_id: The generated ID for a given client provided by the signaling server
|
|
19
|
-
*/
|
|
20
|
-
export type Client = {
|
|
21
|
-
client_id: string;
|
|
22
|
-
connection_id: string;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Session Info
|
|
26
|
-
*
|
|
27
|
-
* The session info used to generate a {@link RTCPeerConnection}
|
|
28
|
-
*
|
|
29
|
-
* @property {@link string} session_id: The session id provided by the signaling server
|
|
30
|
-
* @property {@link string} connection_id: The vehicle's connection id generated by the signaling server
|
|
31
|
-
* @property {@link Client}[] clients: The array of clients that are currently connected to this session
|
|
32
|
-
*/
|
|
33
|
-
export type SessionInfo = {
|
|
34
|
-
session_id: string;
|
|
35
|
-
connection_id: string;
|
|
36
|
-
clients: Client[];
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Connection State
|
|
40
|
-
*
|
|
41
|
-
* Used to describe the current state of the Bridge Box connection process
|
|
42
|
-
* @readonly
|
|
43
|
-
* @enum
|
|
44
|
-
* @member Searching - The connection process has not started yet
|
|
45
|
-
* @member Connecting - Attempting to connect to the signaling server
|
|
46
|
-
* @member Connected - The connection to Bridge Box has been established and WebRTC is being initialized to connect to the vehicle.
|
|
47
|
-
* @member Error - An error occurred when during the connection process
|
|
48
|
-
* @member SSL - The system detected a potential SSL validation error.
|
|
49
|
-
* @member Ready - The connection to the vehicle is successful and both systems (client app & the vehicle) are able to communicate.
|
|
50
|
-
*/
|
|
51
|
-
export declare enum ConnectionState {
|
|
52
|
-
Searching = 0,
|
|
53
|
-
Connecting = 1,
|
|
54
|
-
Connected = 2,
|
|
55
|
-
Error = 3,
|
|
56
|
-
SSL = 4,
|
|
57
|
-
Ready = 5
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Connection Settings
|
|
61
|
-
*
|
|
62
|
-
* These properties are used to customize the signaling server connection process.
|
|
63
|
-
*
|
|
64
|
-
* @property {string} ip: The desired ip address to connect to. If none are provided uses the [default ip address]({@link SIGNAL_SERVER_CONNECTION_STRING})
|
|
65
|
-
* @property {boolean} reconnection: Indicates that the initial connection failed and now the system is attempting to connect again
|
|
66
|
-
* @property {boolean} isElectron: Indicates whether or not the library is being used in an Electron application. Prevents certain states from being reached if it is.
|
|
67
|
-
* @property {callback} onConnectionStateChange: Handler for the connectionState of Bridge Box.
|
|
68
|
-
*/
|
|
69
|
-
export interface ConnectionSettings {
|
|
70
|
-
ip?: string;
|
|
71
|
-
reconnection?: boolean;
|
|
72
|
-
isElectron?: boolean;
|
|
73
|
-
connectionState?: ConnectionState;
|
|
74
|
-
onConnectionStateChange?: (newState: ConnectionState) => void;
|
|
75
|
-
onSocketConnected?: (socket: HubConnection) => void;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* WebRTC Options
|
|
79
|
-
*
|
|
80
|
-
* These callback functions provide access to important elements generated within this library
|
|
81
|
-
*
|
|
82
|
-
* @property {callback} onDataChannel: Triggered whenever a datachannel is created/received. Passes the newly created datachannel back
|
|
83
|
-
* @property {callback} onTrackEvent: Triggered whenever a track event is received. Passes the new track back
|
|
84
|
-
* @property {callback} onSessionList: Triggered whenever a session info event occurs. Passes the updated session info back
|
|
85
|
-
* @property {callback} onJoinSession: Triggered whenever a session is joined. Passes back the session id of the joined session
|
|
86
|
-
* @property {callback} onSessionClose: Triggered whenever the connection closes. No values are passed back
|
|
87
|
-
* @property {callback} onConnectionStateChange: Triggered whenever the {@link RTCPeerConnection} state changes. Passes back the event
|
|
88
|
-
* @property {callback} onError: Triggered whenever an error is encountered. Passes back the error
|
|
89
|
-
*/
|
|
90
|
-
export interface WebRtcOptions {
|
|
91
|
-
onDataChannel: (dataChannel: RTCDataChannelEvent) => void;
|
|
92
|
-
onTrackEvent: (trackEvent: RTCVideoTrackInfo) => void;
|
|
93
|
-
onSessionList: (sessionList: SessionInfo[], callback: (session: SessionInfo) => void) => void;
|
|
94
|
-
onJoinSession: (session: SessionInfo) => void;
|
|
95
|
-
onSessionClose: () => void;
|
|
96
|
-
onConnectionStateChange: (event: Event) => void;
|
|
97
|
-
onError: (reason: unknown) => void;
|
|
98
|
-
onSessionInfo: (session: SessionInfo, call: (session: SessionInfo, connectionId: string) => void) => string | undefined;
|
|
99
|
-
}
|
|
100
|
-
export interface ConfigProperties {
|
|
101
|
-
connectionTimeout?: number;
|
|
102
|
-
abortConnectionTimeout?: number;
|
|
103
|
-
defaultPort?: number;
|
|
104
|
-
defaultAddress?: string;
|
|
105
|
-
defaultConnectionString?: string;
|
|
106
|
-
clientId?: string;
|
|
107
|
-
socketLogging?: LogLevel;
|
|
108
|
-
}
|
|
109
|
-
export type RTCVideoTrackInfo = {
|
|
110
|
-
trackEvent: RTCTrackEvent;
|
|
111
|
-
label: string;
|
|
112
|
-
};
|
|
1
|
+
import { HubConnection, LogLevel } from "@microsoft/signalr";
|
|
2
|
+
/**
|
|
3
|
+
* Answer Event
|
|
4
|
+
*
|
|
5
|
+
* An event triggered during the signaling process
|
|
6
|
+
* @property {@link RTCSessionDescription} sdp: The session description protocol object. See WebRTC documentation for more details
|
|
7
|
+
*/
|
|
8
|
+
export type AnswerEvent = {
|
|
9
|
+
sdp: RTCSessionDescription;
|
|
10
|
+
caller: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Client
|
|
14
|
+
*
|
|
15
|
+
* A structure used for the signaling mechanism to identify connected users
|
|
16
|
+
*
|
|
17
|
+
* @property {@link string} client_id: The human-readable name that a client provides to the signaling server
|
|
18
|
+
* @property {@link string} connection_id: The generated ID for a given client provided by the signaling server
|
|
19
|
+
*/
|
|
20
|
+
export type Client = {
|
|
21
|
+
client_id: string;
|
|
22
|
+
connection_id: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Session Info
|
|
26
|
+
*
|
|
27
|
+
* The session info used to generate a {@link RTCPeerConnection}
|
|
28
|
+
*
|
|
29
|
+
* @property {@link string} session_id: The session id provided by the signaling server
|
|
30
|
+
* @property {@link string} connection_id: The vehicle's connection id generated by the signaling server
|
|
31
|
+
* @property {@link Client}[] clients: The array of clients that are currently connected to this session
|
|
32
|
+
*/
|
|
33
|
+
export type SessionInfo = {
|
|
34
|
+
session_id: string;
|
|
35
|
+
connection_id: string;
|
|
36
|
+
clients: Client[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Connection State
|
|
40
|
+
*
|
|
41
|
+
* Used to describe the current state of the Bridge Box connection process
|
|
42
|
+
* @readonly
|
|
43
|
+
* @enum
|
|
44
|
+
* @member Searching - The connection process has not started yet
|
|
45
|
+
* @member Connecting - Attempting to connect to the signaling server
|
|
46
|
+
* @member Connected - The connection to Bridge Box has been established and WebRTC is being initialized to connect to the vehicle.
|
|
47
|
+
* @member Error - An error occurred when during the connection process
|
|
48
|
+
* @member SSL - The system detected a potential SSL validation error.
|
|
49
|
+
* @member Ready - The connection to the vehicle is successful and both systems (client app & the vehicle) are able to communicate.
|
|
50
|
+
*/
|
|
51
|
+
export declare enum ConnectionState {
|
|
52
|
+
Searching = 0,
|
|
53
|
+
Connecting = 1,
|
|
54
|
+
Connected = 2,
|
|
55
|
+
Error = 3,
|
|
56
|
+
SSL = 4,
|
|
57
|
+
Ready = 5
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Connection Settings
|
|
61
|
+
*
|
|
62
|
+
* These properties are used to customize the signaling server connection process.
|
|
63
|
+
*
|
|
64
|
+
* @property {string} ip: The desired ip address to connect to. If none are provided uses the [default ip address]({@link SIGNAL_SERVER_CONNECTION_STRING})
|
|
65
|
+
* @property {boolean} reconnection: Indicates that the initial connection failed and now the system is attempting to connect again
|
|
66
|
+
* @property {boolean} isElectron: Indicates whether or not the library is being used in an Electron application. Prevents certain states from being reached if it is.
|
|
67
|
+
* @property {callback} onConnectionStateChange: Handler for the connectionState of Bridge Box.
|
|
68
|
+
*/
|
|
69
|
+
export interface ConnectionSettings {
|
|
70
|
+
ip?: string;
|
|
71
|
+
reconnection?: boolean;
|
|
72
|
+
isElectron?: boolean;
|
|
73
|
+
connectionState?: ConnectionState;
|
|
74
|
+
onConnectionStateChange?: (newState: ConnectionState) => void;
|
|
75
|
+
onSocketConnected?: (socket: HubConnection) => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* WebRTC Options
|
|
79
|
+
*
|
|
80
|
+
* These callback functions provide access to important elements generated within this library
|
|
81
|
+
*
|
|
82
|
+
* @property {callback} onDataChannel: Triggered whenever a datachannel is created/received. Passes the newly created datachannel back
|
|
83
|
+
* @property {callback} onTrackEvent: Triggered whenever a track event is received. Passes the new track back
|
|
84
|
+
* @property {callback} onSessionList: Triggered whenever a session info event occurs. Passes the updated session info back
|
|
85
|
+
* @property {callback} onJoinSession: Triggered whenever a session is joined. Passes back the session id of the joined session
|
|
86
|
+
* @property {callback} onSessionClose: Triggered whenever the connection closes. No values are passed back
|
|
87
|
+
* @property {callback} onConnectionStateChange: Triggered whenever the {@link RTCPeerConnection} state changes. Passes back the event
|
|
88
|
+
* @property {callback} onError: Triggered whenever an error is encountered. Passes back the error
|
|
89
|
+
*/
|
|
90
|
+
export interface WebRtcOptions {
|
|
91
|
+
onDataChannel: (dataChannel: RTCDataChannelEvent) => void;
|
|
92
|
+
onTrackEvent: (trackEvent: RTCVideoTrackInfo) => void;
|
|
93
|
+
onSessionList: (sessionList: SessionInfo[], callback: (session: SessionInfo) => void) => void;
|
|
94
|
+
onJoinSession: (session: SessionInfo) => void;
|
|
95
|
+
onSessionClose: () => void;
|
|
96
|
+
onConnectionStateChange: (event: Event) => void;
|
|
97
|
+
onError: (reason: unknown) => void;
|
|
98
|
+
onSessionInfo: (session: SessionInfo, call: (session: SessionInfo, connectionId: string) => void) => string | undefined;
|
|
99
|
+
}
|
|
100
|
+
export interface ConfigProperties {
|
|
101
|
+
connectionTimeout?: number;
|
|
102
|
+
abortConnectionTimeout?: number;
|
|
103
|
+
defaultPort?: number;
|
|
104
|
+
defaultAddress?: string;
|
|
105
|
+
defaultConnectionString?: string;
|
|
106
|
+
clientId?: string;
|
|
107
|
+
socketLogging?: LogLevel;
|
|
108
|
+
}
|
|
109
|
+
export type RTCVideoTrackInfo = {
|
|
110
|
+
trackEvent: RTCTrackEvent;
|
|
111
|
+
label: string;
|
|
112
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deeptrekker/api-channels",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1-testingconnectionfix.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,11 +11,14 @@
|
|
|
11
11
|
"dist/*"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "rollup -c"
|
|
14
|
+
"build": "rollup -c",
|
|
15
|
+
"clean-publish": "yarn && node scripts/publish.js"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"@microsoft/signalr": "^8.0.0",
|
|
18
19
|
"@types/sdp-transform": "^2.4.6",
|
|
20
|
+
"dotenv-flow": "^4.1.0",
|
|
21
|
+
"fs-extra": "^11.3.2",
|
|
19
22
|
"lodash": "^4.17.21",
|
|
20
23
|
"sdp-transform": "^2.14.1"
|
|
21
24
|
},
|