11 lines
385 B
TypeScript
11 lines
385 B
TypeScript
import { io } from "socket.io-client";
|
|
import { API_HOST } from "./util/api";
|
|
|
|
// "undefined" means the URL will be computed from the `window.location` object
|
|
// const URL = process.env.NODE_ENV === 'production' ? undefined : 'http://localhost:4000';
|
|
|
|
const url = new URL(API_HOST);
|
|
export const socket = io(`${url.host}`, {
|
|
path: `${url.pathname.replace(/^\/+/, "")}/socket.io`,
|
|
});
|