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:
@@ -3,6 +3,13 @@ const URL = require('url');
|
|||||||
const db = require('./db');
|
const db = require('./db');
|
||||||
|
|
||||||
function start (server, pingInterval=30000) {
|
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 });
|
const wsServer = new ws.Server({ noServer: true });
|
||||||
wsServer.on('connection', socket => {
|
wsServer.on('connection', socket => {
|
||||||
@@ -21,7 +28,7 @@ function start (server, pingInterval=30000) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
db.listen(["realtime", "event", "project"], (data) => {
|
db.listen(channels, (data) => {
|
||||||
wsServer.clients.forEach( (socket) => {
|
wsServer.clients.forEach( (socket) => {
|
||||||
socket.send(JSON.stringify(data));
|
socket.send(JSON.stringify(data));
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user