实现聊天系统:聊天数据存储在哪里?

发布于 2024-08-05 01:19:43 字数 390 浏览 3 评论 0原文

我正在 asp.net 中实现一个聊天系统,很像 google 聊天,我使用 xmhttp 发送和接收数据,并且我使用一个表来存储所有用户的所有聊天。

我想使用 XMLHttpRequest 在 sql 中创建全局临时表,以便能够更好地组织数据(而不是将所有聊天内容存储在一个表中,这会(我不确定)在许多用户访问它时导致锁定问题.)

对于我的系统来说,我也不必存储聊天内容,所以我认为全局临时表会更好,因为它已经被删除,从而省去了清除它的麻烦。

但是在 Xmlhttprequest 创建表之后,它在创建后就被删除了......为什么会发生这种情况我不知道......我也删除了所有连接关闭行但仍然没有运气

所以我应该做什么做??另外,如果有人知道任何可以向我指出要遵循的最佳实践的在线资源,请告诉我。

i am implementing a chat system in asp.net, much like google chat and i use xmhttp to send and receive data, and i am using a single table to store all chat for all user.

i wanted to create global temporary tables in sql using a XMLHttpRequest so as to be abl to organise data better(instead of storing all the chat in a sigle table which can(i dont know for sure) cause locking issues when many users are accessing it.)

also for my system i don't have to store the chat and so i thought that a global temporary table would be better since it will already be dropped and save me the trouble of clearing it.

but the after the table has been created by the Xmlhttprequest it gets dropped just after its creation....why this happen i don't know....i also have removed all connection closing lines but still no luck

so what should i do?? also if anyone knows of any online resources that can points me about best practices to follow please tell me.

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

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

发布评论

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

评论(2

黯然#的苍凉 2024-08-12 01:19:43

当许多用户访问它时,您的表不会出现锁定问题。临时表并不意味着可以跨调用共享,并且您最终会遇到更多的障碍。最好将数据存储在表中,然后轮询该表。

唯一可能出现“锁定问题”的情况是用户尝试同时将相同的数据块写入同一行……这不应该在聊天应用程序中发生。

此外,Google Chat 使用 COMET 样式实现而不是轮询实现。根据我的经验,COMET >就用户体验进行民意调查。

Your table won't have locking issues with many users accessing it. Temporary tables are not meant to be shared cross-call, and you're going to wind up with far more roadblocks down that path. It is probably better to simply store your data in a table, then poll the table.

The only time you could have "locking issues" is if the users are attempting to write the same chunk of data to the same row at the same time ... which shouldn't be happening in a chat application.

Additionally, Google Chat uses a COMET style implementation instead of a polling implementation. It has been my experience that COMET > polling in terms of user experience.

德意的啸 2024-08-12 01:19:43

实际上,您不应该在数据库中保留任何聊天消息......除非您正在实现离线消息。

You're not supposed to keep any chat messages on your database actually... unless you're implementing offline messages.

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