Skip to content

Commit 7d6bdf9

Browse files
author
shawon-majid
committed
sts and landfill vehicle tracking added
1 parent 7f464d6 commit 7d6bdf9

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

server/src/controllers/tracking.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { Server, Socket } from "socket.io";
2-
import errorWrapper from "../middlewares/errorWrapper";
3-
import { Request, Response } from "express";
42
import { PrismaClient } from "@prisma/client";
53

64
//
@@ -24,11 +22,31 @@ const track = (io: Server) => {
2422
};
2523

2624
const handleSts = (socket: Socket) => {
27-
// to be implemented
25+
const id = socket.handshake.query.id;
26+
27+
socket.on("join_rooms", async (data) => {
28+
if (id == undefined) {
29+
return;
30+
}
31+
console.log("sts", id, "has joined");
32+
33+
socket.join(id);
34+
console.log("joined sts room");
35+
});
2836
};
2937

3038
const handleLandfill = (socket: Socket) => {
31-
// to be implemented
39+
const id = socket.handshake.query.id;
40+
41+
socket.on("join_rooms", async (data) => {
42+
if (id == undefined) {
43+
return;
44+
}
45+
console.log("landfill", id, "has joined");
46+
47+
socket.join(id);
48+
console.log("joined landfill room");
49+
});
3250
};
3351

3452
const handleVehicle = (socket: Socket) => {

0 commit comments

Comments
 (0)