retell-sdk 1.0.11 → 1.0.12
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/index.js +27 -27
- package/index.ts +27 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,33 +10,33 @@ class Retell {
|
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
var client = new WebSocketClient();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
13
|
+
client.on("connectFailed", function (error) {
|
|
14
|
+
console.log("Connect Error: " + error.toString());
|
|
15
|
+
});
|
|
16
|
+
client.on("connect", function (connection) {
|
|
17
|
+
console.log("WebSocket Client Connected");
|
|
18
|
+
connection.on("error", function (error) {
|
|
19
|
+
console.log("Connection Error: " + error.toString());
|
|
20
|
+
});
|
|
21
|
+
connection.on("close", function () {
|
|
22
|
+
console.log("echo-protocol Connection Closed");
|
|
23
|
+
});
|
|
24
|
+
connection.on("message", function (message) {
|
|
25
|
+
if (message.type === "utf8") {
|
|
26
|
+
console.log("Received: '" + message.utf8Data + "'");
|
|
27
|
+
}
|
|
28
|
+
connection.send("12345");
|
|
29
|
+
});
|
|
30
|
+
function sendNumber() {
|
|
31
|
+
if (connection.connected) {
|
|
32
|
+
var number = Math.round(Math.random() * 0xffffff);
|
|
33
|
+
// connection.sendUTF(number.toString());
|
|
34
|
+
connection.sendUTF("12345");
|
|
35
|
+
setTimeout(sendNumber, 1000);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
sendNumber();
|
|
39
|
+
});
|
|
40
40
|
await client.connect("ws://" +
|
|
41
41
|
this.ip +
|
|
42
42
|
"/create-socket?" +
|
package/index.ts
CHANGED
|
@@ -16,35 +16,35 @@ export default class Retell {
|
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
var client = new WebSocketClient();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
client.on("connectFailed", function (error: any) {
|
|
20
|
+
console.log("Connect Error: " + error.toString());
|
|
21
|
+
});
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
client.on("connect", function (connection: any) {
|
|
24
|
+
console.log("WebSocket Client Connected");
|
|
25
|
+
connection.on("error", function (error: any) {
|
|
26
|
+
console.log("Connection Error: " + error.toString());
|
|
27
|
+
});
|
|
28
|
+
connection.on("close", function () {
|
|
29
|
+
console.log("echo-protocol Connection Closed");
|
|
30
|
+
});
|
|
31
|
+
connection.on("message", function (message: any) {
|
|
32
|
+
if (message.type === "utf8") {
|
|
33
|
+
console.log("Received: '" + message.utf8Data + "'");
|
|
34
|
+
}
|
|
35
|
+
connection.send("12345");
|
|
36
|
+
});
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
function sendNumber() {
|
|
39
|
+
if (connection.connected) {
|
|
40
|
+
var number = Math.round(Math.random() * 0xffffff);
|
|
41
|
+
// connection.sendUTF(number.toString());
|
|
42
|
+
connection.sendUTF("12345");
|
|
43
|
+
setTimeout(sendNumber, 1000);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
sendNumber();
|
|
47
|
+
});
|
|
48
48
|
await client.connect(
|
|
49
49
|
"ws://" +
|
|
50
50
|
this.ip +
|