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.

balazs
  • 5,698
  • 7
  • 37
  • 45
  • 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](http://memcached.org/) which have [Delphi](http://code.google.com/p/delphimemcache/) and Java clients available. – mjn Aug 28 '11 at 09:59
  • 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. – mjn Aug 28 '11 at 10:02
  • @mjn 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. – balazs Aug 29 '11 at 07:20
  • 1
    The example is now in progress and a wiki page is available here: [Delphi and Google Web Toolkit (GWT) Integration](https://mikejustin.fogbugz.com/default.asp?W18). The example needs only Java and Maven to build the whole project. – mjn Aug 31 '11 at 17:00
  • @mjn 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. – balazs Sep 01 '11 at 13:41

4 Answers4

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.

Community
  • 1
  • 1
Arnaud Bouchez
  • 42,305
  • 3
  • 71
  • 159
  • 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. – balazs Aug 25 '11 at 16:35
  • @balazs 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. – Arnaud Bouchez Aug 25 '11 at 17:25
  • 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 side – mjn Aug 26 '11 at 05:27
  • @mjn 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). – Arnaud Bouchez Aug 26 '11 at 06:19
  • @mjn thanks for clearify this, I updated the question, because I found something out there. – balazs Aug 26 '11 at 11:23
  • @mjn 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](http://blog.synopse.info/post/2011/08/07/SQLite3-powered%2C-not-SQLite3-limited) is available. See [the documentation of our mORMot framework](http://blog.synopse.info/post/2011/08/10/Framework-documentation-updated-to-revision-1.15). – Arnaud Bouchez Aug 26 '11 at 17:36
  • @Arnaud ok, I already downloaded, thank you. Just need time to understand and go through the docs. – balazs Aug 29 '11 at 07:25
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.

M Schenkel
  • 6,294
  • 12
  • 62
  • 107
1

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

  • 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. – balazs Aug 26 '11 at 11:08
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.

Stijn Sanders
  • 35,982
  • 11
  • 45
  • 67