I run a simple websocket using
const WebSocket = require('ws')
const wss = new WebSocket.Server({ port: 8080 });
when I try to connect to the server using
const connection = new WebSocket('ws://84.***.***.***:8080') // my ip adress
everything works fine, no error, the connection event gets triggered and I can send a message.
If I use my domain though, i.e.
const connection = new WebSocket('ws://sub.example.com:8080')
I get this error:
WebSocket connection to 'ws://sub.example.com:8080/' failed: Error during WebSocket handshake: Unexpected response code: 301
I am using an A record to point the subdomain to my actual domain (using cloudflair, imported from namecheap).
Wikipedia tells me
The HTTP response status code 301 Moved Permanently is used for permanent redirecting, meaning current links or records using the URL this response is received for should be updated.
Any Ideas on what I am doing wrong?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…