Created the socket util

This commit is contained in:
Mathias Wagner 2023-06-01 18:49:30 +02:00
parent 23d43e4af5
commit 4c4865c6f7
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -0,0 +1,11 @@
import { io } from 'socket.io-client';
const URL = process.env.NODE_ENV === 'production' ? "https://tools-api.gnmyt.dev/" : "http://localhost:7182";
export const createConnection = (type) => {
const socket = io(URL, {autoConnect: false});
socket.on("connect", () => socket.emit("type", type));
return socket;
}