Refactor list of notification channels into its own file

This commit is contained in:
D. Berge
2021-05-24 13:38:19 +02:00
parent 56d1279584
commit d40ceb8343
2 changed files with 14 additions and 8 deletions

View File

@@ -0,0 +1,13 @@
// This is the list of all channels for which the
// database issues notifications.
// NOTE: This needs to be kept up to date with
// database schema changes.
module.exports = [
"realtime", "event", "project",
"preplot_lines", "preplot_points",
"planned_lines",
"raw_lines", "raw_shots",
"final_lines", "final_shots", "info"
];

View File

@@ -1,17 +1,10 @@
const ws = require('ws');
const URL = require('url');
const db = require('./db');
const channels = require('../lib/db/channels');
function start (server, pingInterval=30000) {
const channels = [
"realtime", "event", "project",
"preplot_lines", "preplot_points",
"planned_lines",
"raw_lines", "raw_shots",
"final_lines", "final_shots", "info"
];
const wsServer = new ws.Server({ noServer: true });
wsServer.on('connection', socket => {
socket.alive = true;