mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
first test with event sock connection state
This commit is contained in:
parent
26be304699
commit
8f2637c39f
2 changed files with 9 additions and 1 deletions
|
@ -19,9 +19,16 @@ const stateStore = useStateStore(pinia);
|
||||||
import { useSettingsStore } from "../store/settingsStore.js";
|
import { useSettingsStore } from "../store/settingsStore.js";
|
||||||
const settings = useSettingsStore(pinia);
|
const settings = useSettingsStore(pinia);
|
||||||
|
|
||||||
|
export function connectionFailed(endpoint, event){
|
||||||
|
stateStore.modem_connection = "disconnected"
|
||||||
|
|
||||||
|
}
|
||||||
export function stateDispatcher(data) {
|
export function stateDispatcher(data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
|
stateStore.modem_connection = "connected"
|
||||||
|
|
||||||
|
|
||||||
if (data["freedata-message"] == "state-change") {
|
if (data["freedata-message"] == "state-change") {
|
||||||
stateStore.channel_busy = data["channel_busy"];
|
stateStore.channel_busy = data["channel_busy"];
|
||||||
stateStore.is_codec2_traffic = data["is_codec2_traffic"];
|
stateStore.is_codec2_traffic = data["is_codec2_traffic"];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { eventDispatcher, stateDispatcher } from "../js/eventHandler.js";
|
import { eventDispatcher, stateDispatcher, connectionFailed } from "../js/eventHandler.js";
|
||||||
import { addDataToWaterfall } from "../js/waterfallHandler.js";
|
import { addDataToWaterfall } from "../js/waterfallHandler.js";
|
||||||
|
|
||||||
function connect(endpoint, dispatcher) {
|
function connect(endpoint, dispatcher) {
|
||||||
|
@ -17,6 +17,7 @@ function connect(endpoint, dispatcher) {
|
||||||
// handle errors
|
// handle errors
|
||||||
socket.addEventListener("error", function (event) {
|
socket.addEventListener("error", function (event) {
|
||||||
console.error("WebSocket error:", event);
|
console.error("WebSocket error:", event);
|
||||||
|
connectionFailed(endpoint, event)
|
||||||
});
|
});
|
||||||
|
|
||||||
// handle closing and reconnect
|
// handle closing and reconnect
|
||||||
|
|
Loading…
Reference in a new issue