Websocket connection failed.

I'm following the websocket's example and it works fine as it is, however I changed some things and it seems i broke it. The problem is located in the getinitialprops function in _myapp.tsx. The thing is I don't want to use authentication and so I don't need to return session as pageprops in the getInitialProps function so I tried returning an empty object but it gives me an error saying failed to connect to 'ws://localhost:3001/'. I should return something as pageProps so the problem goes away but I don't know what and I couldn't find anything in nextjs documentation. I'm not sure if this is related to tRPC and I'm not smart enough to solve it myself so if you have some idea what it's happening I'd appreciate the help. Thank you!
SK
Satou kuzumaβ€’578d ago
Thats not what I was talking about. What I want to do is use it without a session provider because I don't need auth. My code is this: const MyApp: AppType = ({ Component, pageProps }) => { return <Component {...pageProps} />; }; MyApp.getInitialProps = async ({ctx}) => { return { pageProps: {} }; }; export default trpc.withTRPC(MyApp); And the problem is that I'm returning pageProps as an empty object and that is causing the error what I'm asking is, what should I return as pageProps if don't want to use authentication?
AK
Alex / KATT πŸ±β€’578d ago
just remove the getInitialProps part
const MyApp: AppType = ({ Component, pageProps }) => {
return <Component {...pageProps} />;
};

// MyApp.getInitialProps = async ({ctx}) => {
//
// return { pageProps: {} };
// };

export default trpc.withTRPC(MyApp);
const MyApp: AppType = ({ Component, pageProps }) => {
return <Component {...pageProps} />;
};

// MyApp.getInitialProps = async ({ctx}) => {
//
// return { pageProps: {} };
// };

export default trpc.withTRPC(MyApp);
SK
Satou kuzumaβ€’578d ago
I tried that at first but that causes the same error
UU
Unknown Userβ€’562d ago
SK
Satou kuzumaβ€’562d ago
No, I tried several things without any success. I thought It had to be something with nextjs getInitialProps but can’t find anything in the docs At the end I switched to pusher
UU
Unknown Userβ€’562d ago