diff --git a/src/ui/src/App.vue b/src/ui/src/App.vue
index a319e79..316318f 100644
--- a/src/ui/src/App.vue
+++ b/src/ui/src/App.vue
@@ -50,6 +50,9 @@
\ No newline at end of file
diff --git a/src/ui/src/communication/socket.js b/src/ui/src/communication/socket.js
new file mode 100644
index 0000000..74f4735
--- /dev/null
+++ b/src/ui/src/communication/socket.js
@@ -0,0 +1,29 @@
+import Vue from 'vue'
+
+// const wsUrl = process.env.VUE_APP_WS_URL;
+const wsUrl = "ws://127.0.0.1:50001"
+
+let socket = new WebSocket(wsUrl);
+const emitter = new Vue({
+ methods: {
+ send(message) {
+ if (socket.readyState === 1) {
+ socket.send(JSON.stringify(message));
+ }
+ }, connect() {
+ socket = new WebSocket(wsUrl);
+ socket.onmessage = (msg) => {
+ this.$emit('message', msg.data);
+ };
+ socket.onerror = (err) => {
+ this.$emit('error', err);
+ };
+ socket.onclose = () => {
+ emitter.connect()
+ };
+ }
+ }
+})
+
+emitter.connect();
+export default emitter;
\ No newline at end of file
diff --git a/src/ui/src/store/index.js b/src/ui/src/store/index.js
index ceffa8e..55c95b8 100644
--- a/src/ui/src/store/index.js
+++ b/src/ui/src/store/index.js
@@ -1,17 +1,13 @@
import Vue from 'vue'
import Vuex from 'vuex'
+import ws from './ws'
Vue.use(Vuex)
export default new Vuex.Store({
- state: {
- },
- getters: {
- },
- mutations: {
- },
- actions: {
- },
- modules: {
- }
+ state: {},
+ getters: {},
+ mutations: {},
+ actions: {},
+ modules: {ws}
})
diff --git a/src/ui/src/store/ws.js b/src/ui/src/store/ws.js
new file mode 100644
index 0000000..9cdf031
--- /dev/null
+++ b/src/ui/src/store/ws.js
@@ -0,0 +1,21 @@
+export const state = {
+ wsRes: {}
+};
+
+export const actions = {};
+
+export const mutations = {
+ setWsRes(newState, payload) {
+ state.wsRes = payload;
+ }
+};
+
+export const getters = {};
+
+export default {
+ state,
+ actions,
+ mutations,
+ getters,
+ namespaced: true
+}
\ No newline at end of file
diff --git a/src/ui/src/views/HomeView.vue b/src/ui/src/views/HomeView.vue
index cd99c38..a2a4e2f 100644
--- a/src/ui/src/views/HomeView.vue
+++ b/src/ui/src/views/HomeView.vue
@@ -28,6 +28,8 @@