0

I want to use a linux device like a BananaPi with a socketcan-compatible can-controller to connect to a automotive can-bus and show its data in realtime on a webpage, which should be hosted on the Pi. The data should be listed as hex-values and visualized via graphs (the different signals, for example the current speed).

After some research I discovered node-can and I could get managed to show the can-messages as a list on a webpage. But I noticed, that the messages come with a quite huge delay (~2 secs) when there is a huge busload (I sent can messages in a 1 ms period). The same delay occurs, if I use the following minimalistic example:

var can = require('socketcan');

var channel = can.createRawChannel("can1", true); 

channel.addListener("onMessage", function(msg) { console.log(msg); } );

channel.start();

I am absolutely new in this topic but I think, that nodejs isn't the best choice to realize this project?

Are there any other (better) methods to realize such a system?

I could imagine something like a C-backend, for example based on candump (with this program no delay occurs at the same busload), and a frontend realized with javascript, html and css. But I have no idea how to get those different single programs together. Could you give me a keyword so I have a starting point for further research (websocket?!)?

I also thought about writing the can frames in a sql database and grab them from the database for the webpage-gui but I have no idea, if/how this works and if this is fast enough....

Thanks in advance!

  • If you only need to get stream from server you can utilize `EventSource`, see http://stackoverflow.com/questions/42172172/retrieving-data-from-a-database-using-ajax-without-requesting-every-x-seconds/42172640#42172640, http://stackoverflow.com/questions/42475492/how-to-read-and-echo-file-size-of-uploaded-file-being-written-at-server-in-real – guest271314 Apr 20 '17 at 19:12
  • i would recommend utilizing socket.io – itsundefined Apr 20 '17 at 19:20
  • @slowdeath007: I already used socket.io to show the messages on the webpage. node-can generally seems to have this problem with the delay at large busloads, as the delay also occurs with the minimal example from above (which shows the messages in the console, without webserver or anything else). – misterx Apr 20 '17 at 20:16

0 Answers0