mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 11:37:08 +00:00
Let websocket listen to all DB notification channels
This commit is contained in:
@@ -4,6 +4,13 @@ const db = require('./db');
|
||||
|
||||
function start (server, pingInterval=30000) {
|
||||
|
||||
const channels = [
|
||||
"realtime", "event", "project",
|
||||
"preplot_lines", "preplot_points",
|
||||
"raw_lines", "raw_shots",
|
||||
"final_lines", "final_shots"
|
||||
];
|
||||
|
||||
const wsServer = new ws.Server({ noServer: true });
|
||||
wsServer.on('connection', socket => {
|
||||
socket.alive = true;
|
||||
@@ -21,7 +28,7 @@ function start (server, pingInterval=30000) {
|
||||
}
|
||||
});
|
||||
|
||||
db.listen(["realtime", "event", "project"], (data) => {
|
||||
db.listen(channels, (data) => {
|
||||
wsServer.clients.forEach( (socket) => {
|
||||
socket.send(JSON.stringify(data));
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user