Rename websocket from ws to livedata

Allows devServer to proxy websockets as well...
This commit is contained in:
Thomas Basler 2022-06-18 01:14:31 +02:00
parent 46d88c6520
commit 17cc2a475d
3 changed files with 12 additions and 3 deletions

View File

@ -5,7 +5,7 @@
WebApiClass::WebApiClass()
: _server(HTTP_PORT)
, _ws("/ws")
, _ws("/livedata")
, _events("/events")
{
}

View File

@ -90,7 +90,7 @@ export default {
window.location.protocol === "https:" ? "wss:" : "ws:";
const port = window.location.port;
const host = window.location.hostname;
const webSocketUrl = socketProtocol + "//" + host + ":" + port + "/ws";
const webSocketUrl = socketProtocol + "//" + host + ":" + port + "/livedata";
this.connection = new WebSocket(webSocketUrl);

View File

@ -24,6 +24,15 @@ module.exports = defineConfig({
}
},
devServer: {
proxy: 'http://192.168.20.110/'
proxy: {
'^/api': {
target: 'http://192.168.20.110/'
},
'^/livedata': {
target: 'ws://192.168.20.110/',
ws: true,
changeOrigin: true
}
}
}
})