'What do I put here in Frontend to make websocket data show properly on my VPS?
I am using Express-WS
If I go to postman and do ws://mysite.com/api/post I am connected successfully with a 101 switching protocols. /post is my WS route.
So what do I put here on my frontend? It cant be localhost because it doesnt work with my server. The URL posted above doesnt work here either. Neither does the server IP.
const socket = new window.WebSocket("localhost:4000/api/post");
I've hit a wall, any advice appreciated!
I have tried including the server IP which returns a 404, as well as localhost, which as aspected, doesn't work on the VPS (works fine on local network).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
