Live updates addEvent error

Hi everyone
After spending one all day around this, I’ve figured out to make this work

So, my server is a dedicated server with Linux Debian 9 (due to Plesk not supporting 10) and this is a server in my house behind an ISP NAS.
I also installed Node 13 and not the 14 because I was getting some errors from some modules not supporting the 14 yet.
Scheduler 5.3.6

The server works great, all the domains are up and running.
So I decided to try and install LIVE UPDATES on my test environment.

FIRST MISTAKE

  • You don’t need to have Scheduler or any other product running with node. Am I wrong on that one? When I read the documents thats my first impression, so I did install and run Scheduler on node. I had no ideia about nodejs before that, so now I have some (which is good). I also haven’t noticed any time improvements by switching to node.

SECOND MISTAKE

  • Like I told you before, I had no idea about nodejs, so my second mistake was to try and combine both node processes (the scheduler and the live_updates) in one. That doesn’t come any good. So I discovered that I had to create two different processes in two different ports. Also I had to add TCP port forwarding on my router for both ports (3000 and 8008) in my case.

ERRORS
Creating a node process for Scheduler was relatively easy, however for the live_updates was the HELL. The version of the files available on dhtmlx documents section are a little over dated. Some functions are already deprecated since node 10 (example the fayed-node.js with " new Buffer()", the module “sys” under server.js, etc etc.)
After ignoring a few from this errors, things started to happen, however not totally as expected.
On scheduler I was able to move tasks around, extending, shorting, etc, however creating a new task trows an error:

dhtmlxscheduler.js:5506 Uncaught TypeError: Cannot read property ‘valueOf’ of undefined
at Object.g.addEvent (dhtmlxscheduler.js:5506)
at Object.scheduler.add (dhtmlxscheduler_live_update.js:203)

and the line 203 of that file says

return this.addEvent(data.start_date, data.end_date, data.text, data.id, data);

If I make console.log() of data before that happens, I’m just getting an ID, while all the others (start_date and end_date) are undefined.
Does this have anything to do with the new Buffer() that I’ve mentioned before?

One part of that file has

Faye.WebSocket.Draft75Parser = Faye.Class({
1437: FRAME_START : new Buffer([0x00]),
1438: FRAME_END : new Buffer([0xFF]),

on line 1436.

Well there isn’t much information about this tool around here, so I believe this is not used so much, but still I would like to have answer from someone explaining me if there is any salvation to me, other than downgrading my node into version 9.

I’ve found another post with exactly the same issue but in the year 2016 (4 years ago).
https://forum.dhtmlx.com/t/liveupdate-error/35549?u=contente
It seams that this guy found out what the problem is.
It seams the problem is at the Scheduler it self.
Is there any solution already on dhtml side?

Hi @Contente

I’ve posted an update to the topic you’re referring to:

Please check my reply there, I’ve attached the latest live_update.js as well as the demo package.

Some comments regarding your initial message:

You don’t need to have Scheduler or any other product running with node. Am I wrong on that one?

this is exactly right if I understand you correctly.
The main web app doesn’t have to be implemented in nodejs.
Live updates can work in a separate app schema , and only that app has to be done in nodejs.

Very simply, live updates are implemented the following way:

  1. You have your main web app which your users visit.
  2. You have a separate live-update app, which clients can connect to and exchange messages in real-time.
  3. On the web page, you connect the scheduler to this live update server.
  4. Each time the scheduler successfully saves changes to the database, it sends a message to the live update server which in its turn broadcasts it to all other connected pages.
  5. When the scheduler receives the message from the live update server - it applies the changes locally.

So the main app can work on any backend.
Technically, it wouldn’t be too difficult to implement the live update server on a different platform that supports websockets

Errors you encounter were caused by the fact that the live updates module on our site haven’t seen any updates for a long time,
so it has compatibility issues with both modern nodejs and dhtmlxscheduler.

If you try the latest files I’ve attached, it should work ok. We have a working live-update module for dhtmlxScheduler.NET, the module I’ve attached is a slightly modified version of that, ported back to Faye client.

I’ll duplicate the updated files I’ve attached in another topic:
live_updates.zip (1.6 KB)
scheduler-live-updates-app.zip (10.1 KB)

2 Likes

Thank you so much, I’ll test it ans let you know :slight_smile:

1 Like