实现一个 AJAX 聊天网站

发布于 2024-07-23 08:36:15 字数 290 浏览 4 评论 0原文

我想实现一个具有以下功能的聊天网站:

  1. 与随机选择的陌生人进行直接一对一聊天
  2. 如果我的对话伙伴断开连接,我应该转移到另一个陌生人

简而言之,我想模仿 http://omegle.com/

哪种语言最适合此任务? Jsp和Java? PHP? 应用服务提供商? 其他的?

所有消息都应该通过网络服务器吗?还是有更好的方法?

I want to implement a chat site with following features:

  1. Direct one-on-one chat with a randomly picked stranger
  2. If my conversation partner gets disconnected, I should be shifted to different stranger

In short, I want to imitate http://omegle.com/

Which language is best suited to this task? Jsp and Java? PHP? ASP? Others?

Should all of the messages go through the web server, or is there a better approach?

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

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

发布评论

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

评论(3

救星 2024-07-30 08:36:16

我几年前写过一个 AJAX 聊天教程:

http://www.dynamicajax.com/ fr/AJAX_Driven_Web_Chat-271_290_291.html

我也做了一个 JSON 版本:

http://www.dynamicajax.com/fr/JSON_AJAX_Web_Chat-271_290_324.html

这些是用 PHP 编写的,但后端非常简单,因此您可以轻松地将其移植到您想要的任何语言。 的版本

这是我转换为 ASP.NET http://www.dynamicajax.com/ fr/AJAX_Web_Chat_ASP_NET-271_290_328.html

它的工作原理与 Omegle 非常相似,您所需要做的就是设置代码来随机选择一个陌生人。

I wrote an AJAX Chat tutorial years ago at:

http://www.dynamicajax.com/fr/AJAX_Driven_Web_Chat-271_290_291.html

I also did a JSON version of it too:

http://www.dynamicajax.com/fr/JSON_AJAX_Web_Chat-271_290_324.html

Those are written in PHP but the back end is really simple so you can port it to whatever language you want easily. Here's a version that I converted to ASP.NET

http://www.dynamicajax.com/fr/AJAX_Web_Chat_ASP_NET-271_290_328.html

It works pretty much like Omegle, all you need to do is setup the code to randomly select a stranger.

隐诗 2024-07-30 08:36:16

我最近使用 PHP + AJAX 创建了一个聊天脚本。 是的,我的所有聊天消息都通过服务器,因为它使用 AJAX 和服务器端 PHP 脚本将消息传递给收件人。

有关 PHP 聊天脚本的示例,请参阅:
http://www.phpfreechat.net/

I recently created a chat script using PHP + AJAX. Yes, all of my chat messages went through the server because it used AJAX and server-side PHP scripting to deliver the messages to the recipient(s).

For an example of a PHP chat script, see:
http://www.phpfreechat.net/

栖迟 2024-07-30 08:36:15

您可能需要查看 Google Web Toolkit (GWT)。 Ryan Dewsbury 的书“Google Web Toolkit 应用程序”实际上引导您完成编写基本聊天应用程序的过程。

GWT 允许您编写 Java 代码,并将其编译为 AJAX 应用程序的 Javascript。

You may want to look into Google Web Toolkit (GWT). Ryan Dewsbury's book "Google Web Toolkit Applications" actually runs you through the process of writing a basic chat application.

GWT lets you write Java code that is compiled into Javascript for AJAX applications.

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