1

I have a requirement in which I have to refresh the page if any rows inserted in DB. I am able to read data from DB by using listeners and data is coming till "service layer" of my application. After this I have no idea how to throw this data to UI ?

I am using jQuery in UI. I can write a polling API from UI which can look for any update in backend but that would be inefficient approach (I think). Is there any way in which data can be pushed to UI ?

Thanks in advance

rishi
  • 1,792
  • 5
  • 31
  • 63

1 Answers1

1

Is there any way in which data can be pushed to UI ?

A primary way of having the server push information to the client on the web is through Web Sockets (more info). There are many libraries built on top of Web Sockets that make this client-server two-way communication even easier. Depending on your back-end stack, one of these might be useful:

Node JS (click here for more):

  • Socket.IO: A powerful cross-platform WebSocket API for Node.js.
  • WebSocket-Node: A WebSocket server API implementation for Node.js.
  • Total.js: Web application framework for Node.js (Example: WebSocket chat)
  • Faye: A WebSocket (two-ways connections) and EventSource (one-way connections) for Node.js Server and Client.

Java

  • Java-WebSocket: A WebSocket client and server implementation written in 100% Java.
  • JWebSocket: The open source solution for realtime web developers
  • Atmosphere: Realtime Client Server Framework for the JVM, supporting WebSockets with Cross-Browser Fallbacks
  • Play Framework: The High Velocity Web Framework For Java and Scala
  • Project Tyrus: Open Source Java API for WebSocket

C++

  • WebSocket++: WebSocket++ is an open source (BSD license) header only C++ library that impliments RFC6455 The WebSocket Protocol
  • Wt: An open source widget-centric web application framework for the C++ programming language developed by Emweb.

Here's some more

Community
  • 1
  • 1
nem035
  • 34,790
  • 6
  • 87
  • 99