最基本的消息系统,用于发送简单的短信 [英] Most basic messaging system for sending simple text messages

查看:111
本文介绍了最基本的消息系统,用于发送简单的短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为我正在开发的项目的一部分,您认为什么是在Windows窗体应用程序中发送和接收简单文本消息的最基本框架。



我计划实现的是在MySql DB中使用单个表,将已发送和已接收的消息写入表中。请记住,它是长度不超过150个字符的简单短信。



我使用2列来区分发件人和收件人。在获取我的消息时,我当然在这里查看我的usrID的Sender和Recipient列。然后,我可以将我的已发送消息和已接收消息之间的消息分开。



您看到了什么陷阱,您将如何处理此问题或如何改进它。



请记住:仅限简单短信。



问候,

T



PS:如果你想知道我为什么要重新发明基本的轮子而不使用现有的应用程序(电子邮件或Skype等)...我工作在一个环境中,单个用户可以打开多达8-10个应用程序,以便能够正常工作。在某些情况下,有些用户最多使用12个应用程序。我正在努力通过我的项目减少至少5个申请。



我尝试过:



如上所述,我的问题可以看出。 (输入30个字符很多)

As part of a project I am working on, what would you consider to be the most basic framework for sending and receiving simple text messages in a Windows Forms application.

What I am planning on implementing is to use a single table in a MySql DB, write both Sent and Received messages to the table. Remember, it is simple text messages with a length of no more than 150 characters.

I make use of 2 columns to differentiate between Sender and Recipient. When fetching "my" messages, of course here I look at both the Sender and Recipient columns for my usrID. From there I can then separate the messages between my Sent messages and Received messages.

What pitfalls do you for see, how would you approach this or how would you improve on it.

Remember: Simple Text messages only.

Regards,
T

PS: In case you are wondering why I bother of reinventing the basic wheel and not use existing applications (Email or Skype, etc)... I work in an environment where a single user can have up to 8 - 10 applications open just to be able to do their normal work. In some cases there are users using up to 12 applications. I am working on reducing that by at least 5 applications through my project.

What I have tried:

As explained above in detail as can be seen by my question. (30 characters are a lot to type)

推荐答案

它并不像你想象的那么复杂;毕竟它只是简单的INSERT和SELECT语句。棘手的部分进入实施;特别是在即时检索部分。

过去20年来已经完成的一些方法是循环读取定时器上的新消息,或者利用COMET(又称反向AJAX)。使用HTML5,您现在可以将WebSockets作为一个不错的更新。



截至2015年,Facebook Chat基于XMPP协议,该协议是开源和API可访问的。有独立的服务器包可用,内置了几个邮件服务器(例如SmarterMail)。
It is not as complicated as you think; it is after all just simple INSERT and SELECT statements. The tricky part gets into implementation; particularly on the instant retrieval portions.
Some methods that have been done over the last 20 years is looping to "read" new messages on a timer, or to utilize COMET (aka reverse AJAX). With HTML5 you now have WebSockets as a decent update to this.

Up until 2015, Facebook Chat was based on the XMPP protocol, which is open source and API accessible. There are standalone server packages available and several mail servers have it built in (eg SmarterMail).


Your initial solution seems viable.  I would add a timestamp column to allow selecting messages.  The simplest implementation (unless I am missing something) would be a table with five columns.

 MessageID
 MessageText
 SenderID
 ReceiverID
 TimeStamp

If not using a notification system, polling for new messages could be done using a short time delay if the application is in the foreground (e.g., 3 seconds) and longer if not (e.g., 10 seconds).


我是没有数据库专家,但我很想有三张桌子。一个用于用户,一个用于发送消息,一个用于接收。所有消息都在userid(其中一个用户列)上键入,因此将它们全部绑在一起应该很容易。
I am no DB expert but I would be tempted to have three tables. One for the user, one for sent messages, and one for received. All messages are keyed on userid (one of the user columns), so tying them all together should be easy.


这篇关于最基本的消息系统,用于发送简单的短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆