0
  • In the Backend There is a server, which will create socket. In frontend, React component uses a fetch api from NextJs api routes to contact backend. I want nextjs api route to emit events to frontend, after server emits them & show the output.

  • My backend server runs on port 8000, I am not able to understand how to connect all these 3 elements(Next API, Backend Server, Frontend) together which will be socket-server - socket-client.

  • I tried to create connection with backend, got 404 not found as socket error.

  • backend server and socket both are serving to same port, tried different port but got same error 404.

  • Im expecting, React component to fetch NextJS Api route, which will interact with backend server socket & show those emitted events on React component.

  • Basically nextjs api will be in between frontend & backend passing data/events to & from.

Rohit
  • 1

0 Answers0