we need create timer to nodejs its little challenge :) but you can improve your skills :) if you pass it .. we have another interresting deal for you :)...........
there are two tables
mydevices_mydevices.add_time --> should be from 0 to N
u need map all channel_code onair.channel_code(999,888,777,666,...) and actual value [login to view URL] --- INT 1 or 2 --> each channel_code should have different 1 or 2
onair.channel_code = 999 and [login to view URL] = 1
onair.channel_code = 888 and [login to view URL] = 2
onair.channel_code = 323 and [login to view URL] = 1
if in [login to view URL] changed value from 1 to 2 or from 2 to 1
and user have configured mydevices_mydevices.add_time = 0 then you sending immediately actuall value in [login to view URL] --> 1 or 2
nodejs sending notifications to clients about this changes trought websocket //already working
now we need add timer DELAY
if client have configured delay for sending notification
mydevices_mydevices.add_time = 30
10:00:00 UPDATE onair.channel_code = 888 and [login to view URL] = 2 --> system changed value to 2
10:00:30 send notification to all subscribted clients on onair.channel_code = 888 [login to view URL] = 2 after 30 seconds later ! so 10:00:30 send msg
and scenario continue
about an time will be go back state on same channel_code 888 from 2 to 1
10:05:00 UPDATE onair.channel_code = 888 and [login to view URL] = 1 --> system changed value to 1
10:05:30 send notification to all subscribted clients on onair.channel_code = 888 [login to view URL] = 2 after 30 seconds later ! so 10:00:30 send msg
and there is another situation
USER can switch to another channel_code lets say from 888 to 555
in this case
u need hold time WHEN was changed status [login to view URL] = 1 to [login to view URL] = 2 and [login to view URL] = 2 to [login to view URL] = 1 for some time
then you need apply
[login to view URL] of changed status 2 or 1 and lets say client will come about 30 seconds later as it was changed and user have add_time 30 seconds we need count with this time
and change logically status once changed come... and same on end --- this part we need discuss
it must work in one FUNCTION itself .. not calling like 100 functions for each ... please think for it as there should be connected thousands and more clients....
10 freelancere byder i gennemsnit $47 på dette job
Hey. I am an experienced freelancer with more than 10 years of experience. I work with many reputable companies. I will do your work carefully, efficiently and quickly!
I have been working in a startup for more than 1 year as a Backend developer. I have good grasp on Node.js and Express.js. I'll be able to solve your issue as soon as I can.