Best way to develop a group chat room [closed] - javascript

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 9 years ago.
Improve this question
I'm on developing a new application. It is going to work as follows,
=> All the user will be assigned to a group.
=> When a user logs in, the home page will show a textarea to add a message with all messages of the users who are in that group
=> Somtimes it is possible for one user will be assigned with more than one group, in that case the user have to select the groups they want to share their message.
=> The message sometimes have images and videos as well
In other words a chat room which is almost like the facebook newsfeed.
Now, my question, is there any plugins or script which is easy to be customised. Flash, Javascript.
Or what I can do is send ajax request every second to check the database for new message, grab and fetch on the screen. But the only thing I'm afraid is will it makes the server and/or the app slow or dead.
Please suggest me good solution dear genius brothers.

There are no such scripts to create an chatgroup that easy, you can use ajax to fetch the messages if you like.
But websockets or Server sent events would be a much better idea.
However using Server sent events (SSE) on apache is also not really a good idea as apache will create a proces for each open connection. If you would like to use SSE I suggest using nginx
Link to SSE.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Error_handling
Websockets.
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API

Well learn:
jquery
nodejs
And then come back with other questions.

If you can learn, then learn the following:
Node.js
Angular.js
Socket.io
Express.js
They can make your life easier and this app can be possible in minutes. Look for a demo on the angular site.

Related

How to make a working login functions for my website? [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 last year.
Improve this question
I am just entered this game since last December. Now I finished HTML CSS and a little bit of Java Script yet I got stuck at this stage: I can do basic styling but I don't know how to make it interactive.
So my question is :
how can I make a login function for websites, which can gives visitor an account (sign up, login, forgot password) that can do basic things like comment , add to basket and favorite a product?
Don't need to be specific, please just highlight which language is involved in which stage.
Thanks ahead.
Now I finished HTML CSS and a little bit of Java Script
So your site is what is called a static website.
If you want to allow login and data storing, you need a dynamic website, that requires one of this technologies:
PHP
ASP (check also ASP.NET)
Node.js (with express or http module)
Django (Python's library)
A few others...
All this technologies are called server-side languages/technologies, and the most used for long years has been PHP, that now has some strong rivals in terms of usage.
You can use only html/js to create a website. But, if you need authentication, post comments, a server side is needed.
A js can call easely an API to authenticate (server side) and post comments with XHR. You have to create it. You need to know how Authentication headers works for server side. You need to have a database (sql, file or nosql, it's your choice) to save the users datas and rights.

Implementing a live chat system in Website [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 6 years ago.
Improve this question
I would like to add a live chat support channel in my website, mainly focused on new users who have specific questions about my services and i´be been thinking about the best way to implement this solution myself. do note that i do not intend to use third party solutions.
What i´ve thought about retrieving messages: i can have a form on the page that will activate on user click (like a "start chat" button), once the button is clicked, i will GET all messages in the database related to the client's IP address (if it's not a logged in user) through a web service and load it into the DOM. after this, i will have a javascript function that will execute every XX seconds asking whether there are new messages.
to send messages: the user will have a textArea with a "send" button that will trigger a POST to a web service in order to save their message into the database, on the Support/web admin side, everything will work in a similar fashion but with the option of having several chats at the same time. Also i think I can achieve this by using JQUERY and ajax requests.
Is this a good idea to implement a live chat services? or am I far off from the ideal way of doing this? I have browsed around and all i get is suggestions to use third party service which i definitely do not want to use. Thanks!
You should have a look at websockets, especially at the socket.io library, which provides you an event based communication between the clients and the server.
They even have an example how to create a live chat:
http://socket.io/get-started/chat/
I you want a chat that is not just a "proof of concept", you should go for using XMPP, it's the most popular (and maybe the only-one) opensource instant-messaging protocol. There are several implementations in multiple languages and it has proven its robustness.
Wikipedia :
Extensible Messaging and Presence Protocol (XMPP) is a communications protocol for message-oriented middleware based on XML (Extensible Markup Language). It enables the near-real-time exchange of structured yet extensible data between any two or more network entities.
source
You could also take a look at IRC, which is quite old but still useful.

What all tools needed to design/publish websites? [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 6 years ago.
Improve this question
I am currently in the process of learning web design. I have learned Java, HTML, SQL, Python and am working on CSS and Javascript. I am learning these because the names of these languages pop up alot when i read about web design. So far i have seen the power of HTML, i can type code and open it as a HTML page and it's a webpage. My question is, what to do when you have all the tools to make the website? How does this website get to be on the World Wide Web? I have done a lot of research and i just don't think i understand the logic behind it. I see that i can purchase a domain name, but how do i bridge the gap between, lets say a simple HTML webpage and getting it to pop up on google? Thanks guys!
The domain register (GoDaddy for example) will point your domain to your hosting server (using the domain name servers or DNS for short), then your hosting server will serve your HTML/PHP/CSS files to anyone requesting them.
Using the submit URL link on google (https://www.google.com/webmasters/tools/submit-url) you can tell Google "hey, i got a new domain, come and check it out!" so Google will index it shortly (may vary between 2-14 days.
You need a server to host it on. The easiest way to do this is to use a cloud service such as Amazon's AWS. In fact, if all you are building is a static html/javascript webpage, you can probably just host it on s3.
http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html

How to let people collaborate on same form with real time updates? [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 6 years ago.
Improve this question
I have a html form with some fields that are linked to a database row that have to be modified at the same time by different users.
Every time one of the users edit an input field it may call a javascript onchange (or similar) function to update the specific column in the row, but the other users that have the same page opened don't see the change until they refresh the page.
What should I use to get it changed on all devices that are looking the page?
The backend is in PHP/MySQL.
Thank you
You have a way to send pushes to your backend server but now you need to get pulls from your server.
For this purpose, you need to maintain a constant communication channel between your client and server to get real time updates from your server. There are multiple options for this:
Websockets: A TCP websocket can be used for real time communication between server and client. See this thread to get more information about websocket support in PHP.
Polling (very dirty way): you can do frequent poll from your client to your server to see if there has been any updates or not. This way of implementation is really inefficient and not recommended at all but still, since some applications already have polls in their system, if your system is already doing frequent polls, you can attach the query to get form status with that poll.
There are a couple of possible approaches.
Have an ajax request in the client periodically poll the web server to retrieve the data. Though depending on how this is implemented, there could be some performance ramifications.
You could benefit from using WebSockets. Since you're using PHP and MySQL you might look into something like Ratchet. Depending on how far along the code base is you could potentially implement something with socket.io using node.
When you look for some already existing tools, this might something for you:
https://fusion-tables-api-samples.googlecode.com/svn/trunk/FusionTablesFormSync/docs/reference.html
When you do not find anything that matches your needs, you can write it on your own. Therefore you need Ajax (To transfer a change to the server), it is more easy to use in combination with jQuery.
http://www.w3schools.com/jquery/jquery_ajax_intro.asp
And you can also fetch the data from the server with ajax, but you have to do requests all the time, which is not very nice. An alternative would be websocket, but this need a lot of knowledge.

How does Facebook "like" button work? How to implement a plugin like it? [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
Say I have a Facebook-like website with a high volume of traffic. Now I want to implement something like a Facebook "Like" plugin(?) for my site that other websites can use on their site. Let's call it "Hooray". How do I exactly implement one?
Or how does Facebook, Pinterest, etc. generally do it?
To implement your "Hooray" button you need to have components mentioned below:
A web service which will consumed by the client SDK to report that someone has ""Hoorayed" the post etc.
You need to have a database where you can store who "hoorayed" what.
You can consider every entry as a post or say "Hurricane".
Now every post is unique so you can identify who "Hoorayed" what.
Create a web service which tells the user who "Hoorayed" what.
Create a client SDK. It could be a JS library for web applications or Objective C framework for iOS etc. These client libraries will consume web services which are mentioned above.
Just like FB you will have to ask the consumer of your "Hooray" service to register an app on your platform. You can generate an appid for them and then all the data can be tagged with that.
Obviously these are just pointers and you can create a much sophisticated workflow based on your needs.
If you go on the Facebook developers page, you can access the code for a Facebook "like" plugin in multiple languages and try to figure it out from there.

Categories