Broadcast a popup message to all online users Java,Jsp [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
i wish to add a functionality to my website that is to send a pop up message which i've typed, to all online users . i am able to get user id's of all online users. how could i send message in a jquery pop up to all users. Any one please give me an idea..

The solution to this requires 3 components:
First you need to make sure that whatever is typed is sent to the server. The easiest way is just via an Ajax call whenever you're done typing (or hit a button)
Secondly, you'll have to store the message(s) on the server including what users you've already distributed the message to. This can be just in memory on the server or in a database or file.
Lastly, each of the participating users will have to have a mechanism for retrieving the messages. The easiest way is just to have an Ajax call every 10 seconds for instance which asks the server if there are new messages. If there are they are returned and displayed in a popup.
The server can then mark the message as being sent to that user as well as keep a list of users that are active.
Note both the Ajax communications could be replaced with websocket connections if you want ultimate performance, but they are somewhat harder to set up, so I'd only recommend that if you have many users or many messages.

You can simply write an asynchronous script, that runs in the background, requesting from an API, and if it gets some valid response from API, you can popover a message via jQuery!

Related

java chat program (p2p) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
for a project for school i need to write a chat program.
what i have so far:
database users(Username, Password, IPAddress, onlineStatus)
loginform
mainChatForm
registerForm
im able to connect to the database, register users, check online users,...
but now coms the tricky part and here is where im lost. I now need to write the chatprogram itself. i found some tutorials on the internet but they all use server-client. I dont what to do this i want to make it p2p.
i understand i still need to use the serversocket-socket thing. thats why i keep the users IP in the database.
i need some guidance on how to start to build the chat part of my project.
if someone could help me that would be great.
Thanks
DenTilloZie
If I understand correctly, you will need a central server that holds all of the login information, status of users, and their IP addresses. Users can register their IP address at login time.
In order to initiate a chat with somebody, a user will browse the list of online users on the central server, fetch the IP address of the person they want to communicate with, and then make a direct P2P connection to them.
Everything you need to know about actually implementing this is in the API or stackoverflow. If you have more specific questions about implementation you should probably make another more specific question.
If i'm not wrong, you can make two threads. One holds a server socket and the other a client socket. The server thread will be listening for new messages from the other peer, while the user thread, can be used to send new messages.

Connecting and fetching data from mysql using angularjs [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am new to angularjs , can anybody guide me in performing CRUD operations in MYSQL and display in html form using angularjs... to be more precise... I want to store information to customer details such has name,consumer number,contact,address and update the same whenever necessary using java..
Hello and welcome to SO,
I created this diagram in order to make you feel more comfortable with the subject.
As you may see I didn't mention any language: Client, Server nor Database, because the language itself has nothing to do with REST APIs.
Instructions - begginer:
(If you are using PHP, I'd recommend SlimFramework, which is the light, scale, easy to start with, PHP Framework).
1) Pick a server-side language.
2) Create a Database Resource.
3) Pick a Server Side Language.
4) Create 4 Scripts that each does one of each:
Create,Read,Update,Delete.
5) Connect endpoints with each of the scripts, URL -
GET,POST,DELETE,UPDATE.
6) Verify that you can access each of them from the web (authenticated
or not).
7) After you verified that endpoints are working, time to connect
Angular:
7a) First try to create buttons for each action, and link it with
$http.get, $http.post, $http.delete, $http.put actions.
7b) Once it's working you might wanna step up and use ng-resource or
restangular.
P.S: I didn't supply much code information since once you understand what I stated on top, you'd realize that writing code for that isn't really hard.
After you complete these ,
You might wanna start with: Server side and Client side authentication, Performance, Multiple resources and collections, CORS and preflighted requests, and so on.
Good Luck.

Where to keep the response of web services? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I send request to web services and receive the results, then I need to allow users to sort the results. My question is that after retrieving the results where should I keep them to be able to sort them upon user's request without sending a new request using web services?
why again sending the request to web services i think no need of sending of request again once you received the result just store them in the type what ever they are and sort it mean while and get displayed to the users
You have two choices:
Let the server sort the results before returning them to the user.
Give the client the capability to sort the results on the client side without having to make another web service call.
This is a little bit tricky as there are several choices and you should use the one, depending on your need. You can store the data temporarily in cache or cookie if you don't require any permanent storage. Otherwise, you can use memory or database.
You can also check this link:
http://blog.mafr.de/2009/01/04/session-data-in-webapps/
It highlights some possible solutions.

Android App with Online Database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i'm creating an app wherein the database are uploaded online without website, the concept of the app is like Waze app. I dont know where to start im asking for ideas and help. do i need to create a web server?how?i will mark this correct for those who can answer thanks.
This is not a simple task because it relies on many parts doing its proper job... In order to do what you want to do you need basically 5 things:
1.- Server: which will feed live information to the app.(There is a ton of servers that can be used to get this part done. If you are used to, or willing to learn php, I suggest you to start researching XAMPP (it uses Apache server running php stuff) [https://www.apachefriends.org/es/index.html]).
2.- Database: Most likely the server will need to work with information stored in some place. databases are perfect for just that. XAMPP also comes with MySQL which happens to be the most popular open source database out there.
3.- Format :You need to determine how the information will be passed from the server to the mobile device. The most common ways are: JSON which is plain text, XML that also is plain text but formatted diferently. this is important because you have to send the information from the server using this format and also your mobile devices will need to interpret the information in this format.
4.- Choose a way to send and recive the information : i would suggest Http/Ip protocol for this, as it is very common. Investigate Http requests and responses.
5.- Your device must be listening (or asking) for the content : the device will have to implement some sort of timer to ask the server for new information. This is determined by the logic and prupose of what you wish to do.
do i need to create a web server?
Yes! You need to create a web server, then, a webservice (database query etc...) which communicate between your application and your webserver. I think that all!

Webservice to show Java frame [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need some suggestions if the below idea for my web-service is feasible and if so, some pointers on how to implement the same.
Web-service Request: Request number
Web-service response: Java Jframe popup on users desktop with details of the request queried from the database.
This web-service would get triggered by clicking on an hyper-link in email notification sent to the user.
I cannot write any code on the client side to read the web-service response and then populate the Java frame.
So is it possible for my web-service to pop-up the JFrame on the users desktop when they query the web-service?
If so, how would I configure my response in the WSDL?
The web service runs on the server, the JFrame would run inside a different JVM on the client. So no, the web service can't trigger a JFrame to be shown on the client.
In fact, the web service can't force the client to do anything whatsoever. What the client does with whatever information the web service provides it is totally up to the client, which can be anything, from a Java Swing application (which could use it to display something in a JFrame) to another web service written in Perl (which would likely use it as input for another call or response to something) to an ASP web application (which might display it on a website as a graphic or table of data), to an Oracle SQL query (which may use the result to enter data into a database table which might in turn trigger something else to send an email for example).
That's the very nature of web services, they're utterly agnostic of what and who calls them.

Categories

Resources