编程聊天室,从哪里开始?

发布于 2024-11-10 07:26:38 字数 1455 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

临走之时 2024-11-17 07:26:38

您需要充分了解服务器和客户端技术才能制作功能齐全的聊天客户端。这是相当具有挑战性的,尤其是对于第一次项目。您可能需要使用的一些东西是:

  • PHP 用于处理浏览器和服务器之间的通信,获取用户输入,解析并保存它。
  • MySQL 用于存储用户之间的聊天记录,跟踪谁在什么时间说了些什么。
  • JavaScript 和 AJAX 用于使客户端浏览器显示最新的聊天记录、轮询服务器以获取最新的聊天记录、将用户的聊天记录发送到服务器。

这不是一个微不足道的项目,我花了很多年的时间来学习这些不同的语言,以便能够创建一个安全且可用的聊天客户端。我会为第一次项目推荐一些更简单的东西。

有许多 PHP 的开源聊天客户端。 AJAX 聊天 是一个很好的聊天工具,PHPSimpleChat.

You need to have a good understanding of server and client side technologies to make a full featured chat client. It's quite challenging, especially for a first time project. Some of the things you might need to use are:

  • PHP for handling the communication between the browser and the server, taking the users input, parsing it and saving it.
  • MySQL for storing chat records between users, keeping track of who has said what at which times.
  • JavaScript and AJAX for enabling the clients browser to display latest chat records, polling the server for the latest chat records, sending a users chat records to the server.

It's not a trivial project, it took me years to learn these different languages enough to be able to create a secure and usable chat client. I would recommend something easier for a first time project.

There are many open source chat clients for PHP out there. AJAX chat is a good one as is PHPSimpleChat.

满天都是小星星 2024-11-17 07:26:38

约翰,你的问题表明你正处于这个过程的开始。不幸的是,必要的答案非常广泛,但我会尽力而为。我将大致按顺序列出您应该考虑的事项。

确定有用(且谨慎)的快捷方式

  1. 您可以通过使用现有的聊天室服务来避免构建聊天室的需要吗?我确信有很多服务可以让您获取现有的聊天室代码并重用它,或者与其他人一起托管您的聊天室。
  2. 如果您确实需要自己构建它,您的想法/要求有多少是真正独特的?如果没有太大差异,通常最好定制别人的代码,而不是从头开始构建。

设计项目时的一般考虑因素

  1. 您有多少时间?多少钱?您需要什么质量水平?

需要考虑的技术

LAMP 是一种非常常见的 Web 开发框架,基本上意味着 Linux、Apache、MySQL(或同等版本)和 PHP/Python/Perl/Ruby on Rails/Java。 .NET 是此列表的替代方案。如果该项目很重要,我建议仔细考虑这些选项之间的权衡,并根据您认为合适的方式做出决定。 PHP 是最常见的语言,但 Python 和 Rails(我最喜欢的)可以说更优雅。这三个选项中的任何一个都是完全可靠的,并且会让您处于良好的状态,拥有强大的在线社区和充足的支持。

入门

我对网上资源的丰富程度感到惊讶,而且很多都是免费的、高质量的。我通过从 Borders 获得一本介绍性书籍来开始接触 Rails,这是一个很好的有凝聚力的速成课程,然后我使用 SO、Railscasts 和其他在线资源来回答我遇到的问题。请记住保持您的问题具体且有限,以便将来的答案可以比这个更简洁和尖锐!

祝你的项目好运。

John, your question suggests you are right at the beginning of this process. Unfortunately the necessary answer is incredibly broad, but I'm going to do my best. I'll bullet point considerations you should make, roughly in order.

Identifying Useful (and prudent) shortcuts

  1. Can you get around needing to build a chatroom by using an existing chatroom service? I'm sure there are many services out there where you can take existing chatroom code and reuse it, or host your chatroom with someone else.
  2. If you do need to build it yourself, how much of your idea/requirements are truly unique? If there isn't too much of a difference, it's often best to customize someone else's code rather than building from scratch.

General Considerations in Designing your project

  1. How much time do you have? How much money? What quality level do you need?

Technologies to consider

LAMP is a very common web-development framework, which basically means Linux, Apache, MySQL (or equivalent), and PHP/Python/Perl/Ruby on Rails/Java. .NET is an alternative to this list. If the project is significant, I'd suggest taking a good look at the tradeoffs between these options and making a decision based on what feels right to you. PHP is the most common language, but Python and Rails (my favorite) are arguably more elegant. Any of these three options are completely solid and will put you in good shape, with strong online communities and plenty of support.

Getting Started

I was amazed by how rich the resources are online, and many free and high-quality. I got started in Rails by getting an intro book from Borders for a nice cohesive crash course, then I used SO, Railscasts, and other online resources to answer questions as I got them. Just remember to keep your questions specific and limited so future answers can be more concise and sharp than this one!

Best of luck with your project.

古镇旧梦 2024-11-17 07:26:38

谷歌“node.js chat”获取一些有关如何仅使用 Javascript 构建一个的信息。

这个 one 似乎是一个流行的例子,但看起来现在有一些问题。无论哪种方式,您都可以查看源代码以更好地了解正在发生的事情。

Google "node.js chat" for some info on how to construct one using just Javascript.

This one seems to be a popular example, but it looks like it's having some problems right now. Either way, you can view the source to get a better idea of what's going on.

北方。的韩爷 2024-11-17 07:26:38

PHP 可能是您可以使用的最相关的一种,因为它控制您的数据库和服务器。从技术上讲,这允许您利用聊天室查看彼此之间发生的通信。 JavaScript 可以在形式而非技术方面发挥关键作用,NODE.JS 在这种情况下是最相关的。 SQL 立即记录输入并将其存储在特定的加密中,这将方便地指出用户答案并将其格式化在数据库中。总之,PHP、Javascript、SQL,也许还有一点 Erlang,可以在运行时环境中为您提供帮助。现在,根据您的 Web 服务器,将需要 Apache 配置,具体取决于您的状态。虽然 Perl 和 Ruby 将发挥关键作用,但由于它们的复杂性,请尽量避免使用它们,并在使用它们之前先学习它们的见解和概念。 Python 路由 Web 服务器可以为您的聊天室派上用场,当然这取决于您的知识,并且通用 PHP 代码将维护您的端口,保持对聊天的控制,从而打造一个良好的聊天室。

PHP is probably the most relevant one you can use, as it controls your database and your server. This technically allows you to view the communication occurring with one another utilising the chatroom. Javascript can play a critical roles in the formalities rather than the technicalities, NODE.JS would be the most relevant in this situation. SQL instantly notates the inputs and stores them in particular encryptions, which would conveniently point out the user answer and format them in your database. In conclusion, PHP, Javascript, SQL, maybe a little Erlang, helping you in your runtime environment. Now, depending on your web server, Apache configuration would be required, depending on your status. While Perl and Ruby would play critical roles, try to refrain using them and learning their insights and notions first before utilising them due to their complexity. A Python route web server could come in handy for your chatroom, depending on your knowledge of course, and the general PHP code would maintain your port, maintaining control over the chat and therefore, making a good chat room.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文