Skip to content

Commit

Permalink
🐛 fix: use .env url for socket
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Nov 5, 2021
1 parent a2635a2 commit 2fe71a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/client/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ValuesProvider } from "context/ValuesContext";
import { CitizenProvider } from "context/CitizenContext";
import "styles/globals.scss";
import { SocketProvider } from "@casper124578/use-socket.io";
import { findUrl } from "lib/fetch";

const styles: React.CSSProperties = {
minWidth: "20em",
Expand All @@ -16,9 +17,12 @@ const styles: React.CSSProperties = {
};

export default function App({ Component, router, pageProps }: AppProps) {
const { hostname, protocol, port } = new URL(findUrl());
const url = `${protocol}//${hostname}:${port}`;

return (
<SocketProvider
uri="http://localhost:8080"
uri={url}
options={{
reconnectionDelay: 5_000,
reconnectionAttempts: 50,
Expand Down

0 comments on commit 2fe71a7

Please sign in to comment.