Would a WebSocket plugin be of use to anyone? (Possibly with ServerSide code in NodeJS and/or PHP?)

Would a WebSocket plugin be of use to anyone? (Possibly with ServerSide code in NodeJS and/or PHP?)

jLinuxjLinux Posts: 981Questions: 73Answers: 75

Theres a Plugin I created a while ago called DataTables-Live-Ajax, which basically just keeps a DataTables instance (which uses ajax) up to date. Depending on the setting, it can poll every so often for data, or it can be executed via an API call, but it only updates the table if theres changes, and (if rowId is used) only inserts/removes/updates the rows that need to be.

I was happy with this at first, but I just hate the idea of the browser making AJAX requests over and over and over again... Theres no real way to make that efficient. So I was thinking about making a new plugin, something using WebSockets, so the Plugins JS code (client side) would basically wait for any updates to be sent to it from the server. This would be much more efficient.

The only real downside is that it would require a server side component as well, much like the Server Side processing...

Lately, most of the web development I've done has been in NodeJS, so If I made a customizable server side component to be included, I would definitely include a NodeJS version (But then, what DB Dialect?.. hm), and I may include one using PHP/MySQ: as well...

I wanted to see how many people would use it first though? What do you guys think??!

Thanks

P.S. I posted this in Free Community Support as opposed to Plug-ins, because I wanted everyone to be able to see it and post in it, not just those who have the ability to see the Plug-ins section...

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin
    Answer ✓

    I'm sure plenty of people would be interested in seeing how this might be done. I think it most cases it would need to be customised for each use case - but an overview of how the API can be used would probably be useful for others. I'm fairly sure there are one or two examples kicking around on the web showing DataTables doing this.

    Rather than using server-side processing, I think WebSockets would mainly benefit client-side processing. With server-side processing you always have to update the whole table on each data update - but with client-side you could have the server update an individual cell.

    Allan

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Well the server side would have to send the data... The rest would be done via Javascript. Thats what I was referring to. Is that what you meant as well?

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    And I realize the server side script would have to be customizable, but I also realize it can be done with probably the same settings as the PHP script provided with serverSide, so that shouldnt really be too hard at all.

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    Fair enough. Look forward to seeing what you come up with!

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    It wont be TOO soon, itll be as I need it. Im working on a NodeJS/HapiJS project, and I noticed that there a couple cool plugins that tie into HapiJS and WebSockets (one and two). Obviously not everyone is going to be using HapiJS for their server side, but it gave me the idea.

This discussion has been closed.