Real time web based client for delphi app. HOWTO?
Asked Answered
T

4

6

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.

Taproom answered 25/8, 2011 at 15:24 Comment(5)
GWT + GWT+RPC + Jetty (or Tomcat, JBoss, GlassFish, WebSphere...) can easily be integrated with Delphi. If you have Java Developers around who can create the web layer of your application using these tools, and then integrate the Delphi business layer over synchronous or asynchronous interfaces, it is possible to mix the best of both worlds. For a huge additional performance boost consider caching solutions like memcached which have Delphi and Java clients available.Centistere
Update: if you are interested I can build a complete GWT / Delphi integration example as part of the docs I wrote for my Delphi/Java communication libraries, and publish it with the full Java source code.Centistere
@Centistere Thx. Yes, I'm interested in. A simple example with a SmartGWT widget on the client side, and the same in the delphi side, connected async would be greatly appreciated.Taproom
The example is now in progress and a wiki page is available here: Delphi and Google Web Toolkit (GWT) Integration. The example needs only Java and Maven to build the whole project.Centistere
@Centistere Thanks for the example, It works, and I think I can use for my needs. looks promising, however, as I realized it'll be a long way for me, these technologies are new to me, I have to learn a lot. Thank you again.Taproom
V
3

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.

Verso answered 25/8, 2011 at 16:8 Comment(7)
Thank you for the links, these are great tools, but I need not to write object pascal code, than somehow translate it into javascript, rather communicate through websocket, or longpolling between the client and the server side. Actually GWT will convert java code to javascript.Taproom
@Taproom So you want to write the client part in whole Java? But GWT uses an RPC mechanism based on Java Servlets to provide access to server side resources. So you'd have to write also the server part in Java (or emulate it with Delphi - but sounds hard). I edited my answer to comment deeper with GWT.Verso
Some clarifications about GWT: * GWT does not provide "its own HTTP server", or requires that the HTTP server is Java-based * GWT can use JSON as its protocol, so it does not depend on Java Servlets on the server sideCentistere
@Centistere I was quoting the GWT documentation - but I should have read it further. If you use JSON, you may be interested in our ORM, which implements a Client-Server JSON-based architecture. You may be able to use it with GWT. But the JSON layout is not the same (for instance, we use JSON arrays of double for an array of double property, whereas GWT sounds like expecting a JSON array of objects containing a double property).Verso
@Centistere thanks for clearify this, I updated the question, because I found something out there.Taproom
@Centistere With Delphi 2006, you should better take a look at our ORM. You define Delphi objects on the server, even from existing Delphi code (our ORM is able to handle in-memory objects, or dynamic objects, even using its own SQL engine over those objects thanks to SQLite3 Virtual Tables), then you can access to them with a RESTful JSON interface. Any database is available. See the documentation of our mORMot framework.Verso
@Arnaud ok, I already downloaded, thank you. Just need time to understand and go through the docs.Taproom
M
1

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.

Monongahela answered 25/8, 2011 at 16:4 Comment(0)
T
1

Delphi, pure javascript on client side and shiny interface? You're talking about Unigui!

Thruster answered 26/8, 2011 at 2:10 Comment(1)
not really, I don't want to revwrite the whole app, it's over half million lines. I just want to add a client side. But you are right, Unigui is very promising, maybe I'll use it in another project.Taproom
M
1

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.

Mesothelium answered 28/8, 2011 at 19:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.