|
|
@ -66,7 +66,9 @@ const pubClient = new Redis({ |
|
|
|
port: REDIS_PORT, |
|
|
|
}); |
|
|
|
|
|
|
|
// read from redis |
|
|
|
// ------------------------------ |
|
|
|
// read from redis |
|
|
|
// ------------------------------ |
|
|
|
async function getkey(id) { |
|
|
|
return new Promise((resolve) => { |
|
|
|
pubClient.get(id, function (err, reply) { |
|
|
@ -85,7 +87,9 @@ async function getkey(id) { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// check if stream exists |
|
|
|
// ------------------------------ |
|
|
|
// check if stream exists |
|
|
|
// ------------------------------ |
|
|
|
async function checkstream(data) { |
|
|
|
var res = await getkey(data.id); |
|
|
|
if (res == "1") { |
|
|
@ -106,6 +110,9 @@ async function checkstream(data) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// ------------------------------ |
|
|
|
// --- open socket ------------- |
|
|
|
// ------------------------------ |
|
|
|
io.on("connection", (s) => { |
|
|
|
console.error("socket connection"); |
|
|
|
var usersession = new Object(); |
|
|
@ -134,7 +141,7 @@ io.on("connection", (s) => { |
|
|
|
}); |
|
|
|
|
|
|
|
// ------------------------------ |
|
|
|
// --- event |
|
|
|
// --- event ---------------- |
|
|
|
// ------------------------------ |
|
|
|
s.on("onevent", function (data) { |
|
|
|
var binddata = { |
|
|
|