Is there a way for a web page to respond to a message from a web server, while idle? I need to display a page of user information. As a user swipes his card, a system will authenticate him, and then send a message to my solution, indicating that a user authenticated.
I then need to update a web page with his details. So, no interaction with the page from the user. It must just refresh when I send a message to it - somehow. Is this possible?
I was thinking of some sort of page which has 'subscribed' to events from a server, allowing me to send it, maybe a JSON object, and when it receives this message, refreshes the screen with the data from the messages it recieves?
We don't want to poll the server every second. We need to it respond to an incoming event. So, listening, as opposed to asking. and it has to be quick. So, the only delay would be the amount of time for the message to go from the web server, to the client browser.
We're using .Net application server, standard browser (Chrome, IE etc), a Bootstrap UI (Irrelevant, I guess).
Related
I am building a chat application in Django. But I am confused about how to show messages as soon as the person on the other side sends a message. At present, I have to reload the page to view the messages. I thought of refreshing the page automatically for 3-5 seconds. Is there any way to display messages as soon as the other person sends a message
You need to use websockets to obtain such type of applications . Web sockets maintain a link with your server and when ever there is a change in server the user gets notified automatically without refreshing.
You should use websockets to accomplish this. The library to go is django channels (https://channels.readthedocs.io/en/latest/) and in their example they also build a small chat application.
I'm currently developing a website for a chat application (everything in the serverside is Django).
One of the problems I faced was how to keep the website (once a user is logged and has everything rendered) updated if the user needs to receive something new (a new message, notifications, etc).
The solution I came with was to first create a URL to send a get request, and the response would be a list of unseen notifications for the user. Then, in the HTML, a JavaScript code to send request to this URL and receive the unseen notifications.
This way, upon loading, the page will send a get and receive all unseen notifications and save them in a variable, after that it will keep sending the request every half a second and check if the rendered data is the most recent data, and if it's not, reload the page to refresh all the rendered data.
Now, this works ok, but I'm not sure this is how it should be done, as I'm bombarding with requests my server (currently, everything in development and just a couple of users at the time nothing exploded) and the client is sending request all the time. Is this how other webs (for example Facebook) keep themselves updated in case a new notification appears without the need of the user manually reloading the page?
Thanks in advance!
here is what I want to do:
on a website: www.mySite.com
I want ppl to log on and be able to see other ppl who are currently viewing that webpage.
then I want them to be able to enter text on the webpage and it sends a message to the server
the server then sends this message to all the ppl viewing the page.
then I want the option to select a user from the list of users currently viewing the webpage.
and send that user alone a message (private messaging) but not all the others.
can I do this with html and php? I do NOT want to have a browser refreshing constantly to reload data.
I have looked into websocket technology and so far the only solutions I found is to open a socket connection, wait for a response from server and close the connection on timeout...
then reopen a new one and continously open and close sockets until updates are received by server.
is there a way for the client (browser) to listen for updates without polling a server?
-->>>is there a way for the server to save client addresses and send updates to an open html page (push data) to all those clients, only specific ones, or whatever the case is??<<--
html seems to work fine polling servers but then close connection right away.
Is there a way to keep a socket open indefinately, and not constantly reopen them to simulate server-browser push technology?
I am coding with a simple webserver using html, php and javascript. I am not paying for a virtual machine where I can construct services in my language of choosing.
I prefere not to use a 3rd party to achieve this.
I would like for this to be working on all browsers.
is this possible?
Is there a way that an action initiated by a user, on a client Browser( like clicking a button), can change characteristics of the page loaded by other clients.
The reason I need this is for controlling a device that post information onto a page and waits for a response to see if it can still continue posting information or not. I want that response to come from the user viewing the page. Both client browsers load the page from the server and they are not related in any way.
Thanks
I want to send a request (or any response or notification) from the server side to the browser without a browser request to the server.
I use JSP and the Struts framework in my Java EE application. When some one is on my page, and when some processing in done in my action class/servlets, I want to send a notification or message or request to the browser to be appeared on the page. Here the relevant page cannot be refreshed or reloaded and it may be handled on the browser side with javascript or jquery. I use Http.
Is there a way to do this?
EDIT: Example: The application is an online inventory system. An Admin has logged in. If one of the items is out of stock, the admin should be notified saying that that particular item is out of stock without the admin searching the stores and do nothing (when he is on his account page, a pop up may be displayed to him).
I am not so sure what you meant but according to my understanding you can do this.I guess Comet is the thing you are looking for.Comet is the technique where in server pushes the data to the browser.
Try Pushlet concept which might address your requirement
http://www.javaworld.com/jw-03-2000/jw-03-pushlet.html