This repository has been archived on 2025-03-19. You can view files and clone it, but cannot push or open issues or pull requests.
Files
PowerTools/client/src/common/utils/SocketUtil.js

12 lines
364 B
JavaScript

import { io } from 'socket.io-client';
const URL = process.env.NODE_ENV === 'production' ? (localStorage.getItem("url") || "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;
}