@vgroup/dialbox 0.2.81 → 0.2.83
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.
|
@@ -1647,23 +1647,27 @@ class IncomeingCallSocketService {
|
|
|
1647
1647
|
}
|
|
1648
1648
|
connect() {
|
|
1649
1649
|
// Replace with your WebSocket URL
|
|
1650
|
-
this.socket = new WebSocket(`${environment.websocketUrl}incoming/call`);
|
|
1650
|
+
this.socket = new WebSocket(`${environment.websocketUrl}incoming/call?userId=${localStorage.getItem('userId')}&authKey=${localStorage.getItem('ext_token')}`);
|
|
1651
1651
|
this.socket.onopen = () => {
|
|
1652
1652
|
console.log("WebSocket connected");
|
|
1653
1653
|
// Authenticate (if needed)
|
|
1654
|
-
const authMessage = {
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1654
|
+
const authMessage = { "incomingCall": {
|
|
1655
|
+
"userId": localStorage.getItem('userId')
|
|
1656
|
+
} };
|
|
1657
|
+
// {
|
|
1658
|
+
// userId: localStorage.getItem('userId'),
|
|
1659
|
+
// authKey: localStorage.getItem('ext_token')
|
|
1660
|
+
// };
|
|
1658
1661
|
this.socket?.send(JSON.stringify(authMessage));
|
|
1659
1662
|
};
|
|
1660
1663
|
this.socket.onmessage = (msg) => {
|
|
1664
|
+
console.log("WS RAW:", msg.data);
|
|
1661
1665
|
try {
|
|
1662
1666
|
const data = JSON.parse(msg.data);
|
|
1663
1667
|
this.eventSubject.next(data);
|
|
1664
1668
|
}
|
|
1665
1669
|
catch (e) {
|
|
1666
|
-
console.error("
|
|
1670
|
+
console.error("WS PARSE ERROR:", msg.data);
|
|
1667
1671
|
}
|
|
1668
1672
|
};
|
|
1669
1673
|
this.socket.onerror = (err) => {
|
|
@@ -1671,7 +1675,7 @@ class IncomeingCallSocketService {
|
|
|
1671
1675
|
};
|
|
1672
1676
|
this.socket.onclose = () => {
|
|
1673
1677
|
console.warn("WebSocket disconnected");
|
|
1674
|
-
setTimeout(() => this.connect(),
|
|
1678
|
+
setTimeout(() => this.connect(), 100); // Auto-reconnect
|
|
1675
1679
|
};
|
|
1676
1680
|
}
|
|
1677
1681
|
listen() {
|