Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.direnv
.envrc
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import * as http from 'http';
import * as socketio from 'socket.io';
import * as fs from 'fs';
import * as path from 'path';
import * as mqtt from 'mqtt';

const app = express();
const server = http.createServer(app);
const io = new socketio.Server(server);
const client = mqtt.connect("mqtt://mqtt.hacklab");

const connections = new Set();

Expand Down Expand Up @@ -111,6 +113,8 @@ app.get('/reset', (req, res) => {

let rawTimestamp = req.query.time || req.query.timestamp;
applyDelta(res, resetTimer(name, rawTimestamp));

client.publish("time-since-last/reset-occurred", name);
});

app.get('/history', (req, res) => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"express": "^5.1.0",
"mqtt": "^5.15.1",
"socket.io": "^4.8.1"
},
"type": "module"
Expand Down