Skip to content

Commit

Permalink
⚡ change the telemetry websocket implementation
Browse files Browse the repository at this point in the history
Signed-off-by: JAGFx <contact@jagfx.fr>
  • Loading branch information
JAGFx committed Aug 25, 2021
1 parent b9f62bb commit 40f9ab1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"vue-clipboard2": "^0.3.1",
"vue-insomnia": "^0.1.0",
"vue-progressbar": "^0.7.5",
"vue-socket.io-extended": "^4.2.0",
"vuex": "^3.6.2"
},
"devDependencies": {
Expand Down
5 changes: 0 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ export default {
return currentSkin.id + 'Dashboard';
}
},
sockets: {
log( log ) {
this.$updateEvent( log );
}
}
};
</script>
Expand Down
5 changes: 0 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ import 'bootstrap/dist/js/bootstrap.bundle';
import Vue from 'vue';
import VueClipboard from 'vue-clipboard2';
import VueInsomnia from 'vue-insomnia';
import VueSocketIOExt from 'vue-socket.io-extended';
import { io } from 'socket.io-client';

const socket = io( 'http://' + window.location.hostname + ':3000' );

Vue.use( BootstrapVue );
Vue.use( IconsPlugin );
Vue.use( VueClipboard );
Vue.use( VueInsomnia );
Vue.use( AppPlugin );
Vue.use( VueSocketIOExt, socket, { store } );

Vue.config.productionTip = false;

Expand Down
15 changes: 15 additions & 0 deletions src/plugins/app.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { event, history } from '@/utils/utils';
import store from '@/store';
import { io } from 'socket.io-client';

export default {
install( Vue ) {
Expand Down Expand Up @@ -37,5 +38,19 @@ export default {
} );
}
};


const telemetrySocket = io( 'http://' + window.location.hostname + ':3000' );
telemetrySocket.on( 'connect', () => {
store.dispatch( 'telemetry/socket_connect' );
} );
telemetrySocket.on( 'update', data => {
store.dispatch( 'telemetry/socket_update', data );
} );
telemetrySocket.on( 'log', data => {
Vue.prototype.$updateEvent( data );
} );

Vue.prototype.$telemetrySocket = telemetrySocket;
}
};

0 comments on commit 40f9ab1

Please sign in to comment.