Skip to content

Commit

Permalink
fix: join stream checks now if stream ended
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis3797 committed Jun 16, 2024
1 parent 9ac7d08 commit 39aad5c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion apps/api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ io.on("connection", (socket) => {
select: {
id: true,
streamerId: true,
created_at: true
created_at: true,
ended_at: true
}
});

Expand All @@ -260,6 +261,20 @@ io.on("connection", (socket) => {
});
}

if (checkStream.ended_at) {
return callback({
success: false,
data: null,
error: [
{
name: "Stream Ended",
code: -1,
msg: "This stream has already ended."
}
]
});
}

if (!streams.get(streamId)) {
// create stream
streams.set(streamId, {
Expand Down

0 comments on commit 39aad5c

Please sign in to comment.