罗尔+ SMS:用于发送/接收 SMS 的 Rails Web 应用程序架构?

发布于 2024-07-05 23:35:16 字数 183 浏览 5 评论 0原文

哪种 Web 应用程序架构可以很好地接收/发送 SMS 短信? 我所说的“架构”是指特定的架构,而不是一般的架构,例如 MVC。

背景:我正在构建一个 Web 应用程序,该应用程序从手机接收查询/向手机发送答案。应用程序设计(和业务模型)期望与手机设备进行通信通过短信 IOW:没有 MVC 网页“视图”。手机屏幕实际上是“视图”。

What web app architecture works well receiving/sending SMS text messages? By "architecture, I mean specific architecture, not generally, such as MVC.

Background: I'm building a web app that receives queries from/sends answers to cell phones. The app design (and business model) expects to communicate with cell devices via SMS text messages. IOW: There is no MVC web page "view". The cell phone screen is effectively the "view".

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

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

发布评论

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

评论(3

慕烟庭风 2024-07-12 23:35:19

在使用 Rails 之前我已经制作了其中之一。 我创建了一个预算跟踪器,可以用手机发送命令。 我用它创建了一份我需要在即将到来的薪水中购买/照顾的物品列表。 当支票进来时,我会发送命令将每个项目从列表中标记出来。 我还包含了查询列表的命令。 这些命令类似于“lc mar4”,用于创建三月份预算列表中的第四个薪水。 创建列表后,我可以在不指定列表的情况下发送命令,并且如果未指定列表,我使脚本仅将命令应用于最后一个列表,并缩小其他参数。 “la Court 50 p”也会在 mar4 列表中添加一个名为“court”、值为 50 的项目和一个标签“p”,我将其称为待处理。 当我在周五处理法庭时,我可以发送“lu Court 50 d”,这将使用相同的值更新法庭项目,并带有“d”标签表示完成。 我有一个名为“lp”的命令,它可以打印当前列表。 “lp d”将打印当前列表上所有带有“d”标记的项目。 “lsum p”将打印当前列表上的所有待处理项目。

我制作了一个空的 Rails 应用程序。 制作了我的数据库架构和模型,但没有控制器。 我在脚本中有一个脚本,其中包含一个 pop/ssl 库,我找到了一个可以从我为此设置的 gmail 帐户下载电子邮件的地方。 从那时起,一切就变得非常简单,只需检查每条消息的新消息,确保它来自我的手机,然后解析该消息,然后可以选择发回响应。 (我已将该电子邮件地址编程到我的手机中,并向该电子邮件地址发送文本命令)。 我添加了一个 cron 作业并将其设置为每分钟运行一次。

我不知道该架构是什么,但它基本上是一个查询第三方并根据响应执行不同操作的服务。 如果您使用短代码进行了真正的短信,我现在会让您知道,我认为真正做到这些需要大量投资。 通过短信网关使用电子邮件短信开始开发可能会更容易。

我并不是说这是迄今为止最好的方法,将消息“推送”给我而不是每分钟都检查会更酷,但是嘿,我只是想用手机平衡我的预算。

I've made one of these before using rails. I created a budget tracker I could send commands to with my cell phone. I used it to create a list of items i needed to buy/take care of on the upcoming paycheck. When the check came in, I would send commands to mark each item off the list. I included commands to query a list as well. The commands looked something like "lc mar4" to create the fourth paycheck in march's budget list. Once a list was created, I could send commands without specifying the list and I made the script just apply the command to the last list if no list was specified and crunch down the other arguments. "la court 50 p" would add too the mar4 list an item named "court" with a value of 50 and a tag "p" which I called pending. When I took care of court that friday, I could send "lu court 50 d" which would update the court item with the same value with the tag "d" for done. I had a command called "lp" which would print the current list. "lp d" would print all the "d" tagged items on the current list. "lsum p" would print all the pending items on the current list.

I made an empty rails app. Made my database schema and my models but had no controllers. I had a script in scripts that included a pop/ssl library i found somewhere to download email from a gmail account i had setup for this. From then on it was pretty easy, just check the new messages for each message make sure it came from my cell phone and parse the message and optionally send back a response. (I had programmed that email address into my cellphone, and sent text commands to that email address). I added a cron job and set it to run every minute.

I don't know what that architecture is, but its basically a service that queries a 3rd party and does different things dependent on the response. If you did true SMS with shortcodes, I'll let you know now that I think there is a sizeable investment necessary to do those for real. Might be easier to start develop with email text messaging through sms gateways.

I'm not saying this is the best way to do it by far, It would have been cooler to have had the messages "pushed" to me instead of checking every minute, but hey I just wanted to balance my budget with my phone.

烟燃烟灭 2024-07-12 23:35:18

This depends on how you will be receiving and sending the SMS messages.

There is a specific Short message protocol (SMPP - http://en.wikipedia.org/wiki/SMPP).
For that you will need an SMPP server.

If you are using a one of the various SMS over HTTP providers (such as Clickatell - http://www.clickatell.com), then a web framework such as RoR is fine as both the sending and receiving of SMS messages are actually web requests.
In this case your system view is the HTTP response to the gateway, not the cellphone screen. There are actually quite a few steps involved:
Cellphone -> Cellular Network -> Gateway -> Your Service and the reply: Cellphone <- Cellular Network <- Gateway <- Your Service

感情洁癖 2024-07-12 23:35:18

我会质疑这是否真的是一个网络应用程序。 如果视图层是SMS,则不必使用互联网作为传输,您可以使用硬件连接到手机网络。

如果您正在考虑使用商业 http/sms 网关,可以使用 关于使用 Ruby Clicktell gem 的好文章 Rails 应用程序。 似乎是一个值得尝试的好路线。

I would question whether this is really a web application. If the view layer is SMS, you don't have to use the internet as a transport, you could use hardware to connect to the cell phone network.

If you are thinking of using a commercial http/sms gateway, there is a good article on using the Ruby Clicktell gem from a Rails application. Seems like a good route to try.

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