1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

fixup! fixup! WIP: Using socket.io for websocket handling

This commit is contained in:
Stepan Henek 2022-07-21 16:39:07 +02:00
parent f07e3f323f
commit 3b560cb98f
No known key found for this signature in database
GPG Key ID: 08081019647EB8F2
2 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,7 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
export const REFORIS_URL_PREFIX = "/reforis"; export const REFORIS_URL_PREFIX = process.env.REFORIS_PREFIX || "/reforis";
export const REFORIS_API_URL_PREFIX = `${REFORIS_URL_PREFIX}/api`; export const REFORIS_API_URL_PREFIX = `${REFORIS_URL_PREFIX}/api`;
export const ForisURLs = { export const ForisURLs = {

View File

@ -7,12 +7,14 @@
/* eslint no-console: "off" */ /* eslint no-console: "off" */
import { REFORIS_URL_PREFIX } from "../utils/forisUrls";
const { io } = require("socket.io-client"); const { io } = require("socket.io-client");
export class WebSockets { export class WebSockets {
constructor() { constructor() {
this.socket = io("/notifications", { this.socket = io("/notifications", {
path: "/reforis/reforis-ws", path: `${REFORIS_URL_PREFIX}/reforis-ws`,
}); });
this.connection = null; this.connection = null;
this.socket.on("disconnect", (reason) => { this.socket.on("disconnect", (reason) => {