Browse Source

man poc

master
zeus 3 years ago
parent
commit
65e733138a
  1. 9
      poc-datacollector/modules/ROOT/pages/doc-readmongo_service.adoc

9
poc-datacollector/modules/ROOT/pages/doc-readmongo_service.adoc

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

Loading…
Cancel
Save