Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to push data from http server side to browser client

What will be the best way to push data from server side to client, while client is a web browser.

My server side is build in java, and client side is on html, js, ajax.

Mode of communication is HTTP protocol.

like image 235
anij Avatar asked Apr 04 '14 14:04

anij


People also ask

How does server push data to client?

The server sends messages to the client using event stream format, a simple stream of text data that is encoded using UTF-8. Once contact has been established, the HTTP connection is kept open for the given message stream, so that the server can send updates.

How can data be passed to the client from the server side in HTML?

To pass the value of client side, you can use javascript to pass that value to a <asp:HiddenField > first, then do a post back. At the server side you can retrive the value.

How send data from server to client without request?

You can use web-sockets which are two way communication between client and server that remain open and allow the server to send without request from the client. However web-sockets are new and browser support is only for the most current browsers.


1 Answers

WebSockets is the "real" way to do it. WebSockets

Java Implementation Atmosphere

like image 152
Eugene Avatar answered Oct 20 '22 00:10

Eugene