I'm currently working in a simple game and I want to implement a multiplayer mode. I would like to use Gun however I had found the documentation lacking on trending frameworks like Next.js, Solid, Qwik, ect... I tried to use it in a Next app just like the documentation said but I was bombed with a lot of issues in the terminal. I figured that the server and client versions were getting conflicted so I just add the scrips to the app like so:
And augment the type definitions for typescript. This worked but another set of errors popped up.
WebSocket connection to 'ws://localhost:8765/gun' failed:
WebSocket connection to 'ws://localhost:4000/gun' failed:
I saw this other issue #1278 and it seems like I need to create a peer server but I and link the client and server for them to work. However, I do not want to create a single file for a server and every time I run my app run another terminar with the dev server or install unneeded dependencies to run 2 commands at the same time. I would like to use a Next.js api route to create the relay server but I do not know how to.
I'm currently working in a simple game and I want to implement a multiplayer mode. I would like to use Gun however I had found the documentation lacking on trending frameworks like Next.js, Solid, Qwik, ect... I tried to use it in a Next app just like the documentation said but I was bombed with a lot of issues in the terminal. I figured that the server and client versions were getting conflicted so I just add the scrips to the app like so:
Next.js 13
And augment the type definitions for typescript. This worked but another set of errors popped up.
I saw this other issue #1278 and it seems like I need to create a peer server but I and link the client and server for them to work. However, I do not want to create a single file for a server and every time I run my app run another terminar with the dev server or install unneeded dependencies to run 2 commands at the same time. I would like to use a Next.js api route to create the relay server but I do not know how to.
Can somebody help me to figure this out?