import { createContext, useContext } from "react" import { io } from "socket.io-client" import { WEBSOCKET_PUBLIC_URL } from "../../config.mjs" export const socket = io(WEBSOCKET_PUBLIC_URL, { transports: ["websocket"], }) export const SocketContext = createContext() export const SocketContextProvider = ({ children }) => ( {children} ) export function useSocketContext() { const context = useContext(SocketContext) return { socket: context } }