Update socket api

This commit is contained in:
jeffvli
2022-11-16 19:52:55 -08:00
parent 04b45e26cd
commit c89808fd14
+13 -6
View File
@@ -1,9 +1,16 @@
import { io } from 'socket.io-client'; import { io } from 'socket.io-client';
import { useAuthStore } from '@/renderer/store';
const { username } = JSON.parse( export const socket = io(useAuthStore.getState().serverUrl, {
localStorage.getItem('store_authentication') || '{}' query: {
).state.permissions; id: useAuthStore.getState().permissions.id,
username: useAuthStore.getState().permissions.username,
export const socket = io('http://localhost:8843', { },
query: { username }, reconnection: true,
reconnectionAttempts: 10,
reconnectionDelay: 500,
});
socket.emit('join', {
id: useAuthStore.getState().permissions.id,
}); });