Delphi 应用程序的实时基于网络的客户端。如何操作?
首先,我想要的东西相当复杂,至少对我来说是这样,但另一方面,它听起来很令人兴奋。
我有一个用 delphi 编写的软件,我想要一个基于网络的实时客户端。
要求:
- 在客户端纯Javascript
- Shiny接口(GWT,SmartGWT)
- 服务器和客户端之间的异步连接。 Ajax 推送、长轮询、Comet、WebSocket?
在服务器端的
- 可扩展性
在 delphi 方面,我认为我可以使用 Overbyte 的 ICS 来处理请求。我知道 ICS pack 中的 THttpAppSrv 可以轻松地提供简单的内容,但是 Websocket 怎么样,或者我如何用它进行长轮询?
你觉得怎么样,这是一个很好的组合(客户端的 GWT、SmartGWT 和 delphi 端的 ICS),是否有任何示例项目,或者还有其他解决方案吗?
更新 感谢您的有用评论,我想我更接近解决方案了。很高兴知道 GWT 可以使用自定义服务器,但我认为 Arnaud 是对的,GWT 及其自己的 Jetty 服务器是一个完整的解决方案,但不幸的是不适合我。 :) 我想我需要一个用delphi编写的服务器,它可以与GWT RPC通信。
更新2 我接受了 Arnaud Bouchez 的答案,它看起来对最初的问题来说是最好的,但是我认为有一个更好的解决方案(如果您稍微改变一下要求)来为 delphi 应用程序创建在浏览器中运行的客户端。我只是在这里发表一点评论,分享一下想法。最后我使用了 node.js 服务器,并在 ZMQ。
First of all what I want is quite complex, at least for me, but on the other hand it sounds exciting.
I have a software written in delphi, and I want a real time web based client for it.
The requirements:
- On the client side pure Javascript
- Shiny interface ( GWT, SmartGWT )
- Asynchronous connection between the server and the client. Ajax push, Long Polling, Comet, WebSocket?
On the server side
- scale-ability
On the delphi side I think I could use ICS from Overbyte, to handle the requests. I know that THttpAppSrv from ICS pack can easily serve simple content, but what about Websocket, or how can I do long polling with it?
What do you think, is it a good combo ( GWT, SmartGWT on the client side, and ICS on the delphi side ), is there any sample project out there, or is there any other solution?
Update
Thanks for the useful comments, I think I get closer to the solution. It's good to know that GWT can use a custom server, however I think Arnaud is right, GWT with it's own Jetty server is a complete solution, but unfortunately not for me. :) I think I need a server written in delphi, which can communicate with GWT RPC.
Update 2
I accepted Arnaud Bouchez's answer which looks me the best for the original question, however I think there's a better solution (if you change the requirements a little) for creating a client running in the browser for a delphi application. I just make a little comment here, to share the idea. Finally I used a node.js server, and connected it to my delphi app with the help of ZMQ.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
关于Delphi端的HTTP服务器,可以考虑使用微软自XP以来提供的内核模式http.sys服务器。应该比ICS更快。
对于 AJAX 部分,请查看 Op4JS 或后续的 ElevateDBBuilder。
这些解决方案的优点在于您可以编写对象 pascal 代码,并且该代码将被转换为 JavaScript。尚未完成,但值得等待一下他们的发布时间。
当然,确实存在更经典的 AJAX 解决方案,例如 IntraWeb 或 ExtPascal。两者都实现了自己的网络服务器。
关于 GWT,据我所知,它们是 Java 库,与 Java 世界紧密相连。您将无法使其与 Delphi 一起工作。
关于 GWT 的编辑:
GWT 是一个完整的客户端-服务器框架。
如果您使用 GWT,我怀疑您最终会在某个时候对应用程序进行完整的 Java 重写。否则您将错过 GWT 作为框架的最大乐趣。这是你的选择。
我宁愿依赖一些更标准的方法,例如使用 JSON 进行通信,就像我们使用框架一样。
About the HTTP server on the Delphi side, consider using the kernel mode http.sys server provided by Microsoft since XP. Should be faster than ICS.
For the AJAX part, take a look at Op4JS or up to come ElevateDBBuilder.
What is great with those solutions is that you can write object pascal code, and that this code will be translated to JavaScript. Not yet finished, but worth waiting a little for their release time.
Of course, more classic AJAX solutions do exist, like IntraWeb or ExtPascal. Both implement their own web server.
About GWT, AFAIK they are java libraries, deeply linked to the Java world. You won't be able to make it work with Delphi.
Edit about GWT:
GWT is a full Client-Server framework.
If you go with GWT, I suspect you'll end with a full Java rewrite of the application at some point. Or you'll miss most interest of GWT as a framework. It's your choice.
I'd rather rely on some more standard approach, using JSON for communication for instance as we do with our framework.
您查看过 Intraweb 吗?我自己并没有广泛使用它 - 但它似乎对于 Delphi Web 应用程序非常流行。
我使用 TWebBroker 和 IIS 或 Apache 制作了多个 Web 应用程序。它是异步的,允许您轻松地与其他应用程序移植/共享 Delphi 代码。并且它将支持 Ajax 调用。
Have you checked out Intraweb? I have not used it extensively myself - but it seems to be quite popular for Delphi web apps.
I have made several Web Apps using TWebBroker with either IIS or Apache. It is Asynchronous, and allows you to easily port/share Delphi code with your other application. And it would support Ajax calls.
Delphi,客户端纯 JavaScript 和闪亮的界面?你说的是Unigui!
Delphi, pure javascript on client side and shiny interface? You're talking about Unigui!
我之前从事 PHP、ASP 和 Cold Fusion 工作,并且想对 Delphi 做(几乎)同样的事情。我开始了xxm。它在同一文件中包含 Delphi 和 HTML 代码,并且当您在浏览器中点击刷新时(重新)编译库。我为这些库制作了处理程序,以便您可以在 IIS、Apache、InternetExplorer、Firefox 中运行它们,或者直接从基于 Delphi 的 HTTP 实现运行它们。 (我也开始研究 http.sys 处理程序,但这需要更多的工作。)
另外,关于你的问题,我想要流,我希望我输出的内容能够得到ASAP 传输到侦听客户端,因此您可以执行长时间运行的页面、长时间轮询等操作。至于GWT和其他客户端脚本,我已经成功地使用了prototype和jquery。
I worked on PHP, ASP and Cold Fusion before, and wanted to do (almost) the same with Delphi. I started xxm. It has Delphi and HTML code in the same files, and (re)compiles a library when you hit refresh in a browser. I've made handlers for these libraries so you can run them in IIS, Apache, InternetExplorer, Firefox, or straight from a Delphi-based HTTP implementation. (I started work on a http.sys handler also, but that'll take a lot more work.)
Also, in relation to your question, I wanted streaming, I wanted that what I output would get transferred ASAP to the listening client, so you could do long running pages, long polling, and the like. As for GWT and other client-side script, I've successfully used prototype and jquery.