Testing with an ISAPI Application

In previous section we set up a dedicated WebSockets server running on default HTTP ports. Now we can test our dedicated server with an ISAPI application. As mentioned before, there are several benefits of using a dedicated WebSockets server. One important benefit is that you can share it among various applications and also make sure that everything is served through standard HTTP ports, eliminating the need to expose additional ports to the public web.

We will use the same Basic Chat project for this purpose. This project is already a combo project and can be easily converted to an ISAPI DLL by a small modification in the project file.

Original define in the project file:

{$define UNIGUI_VCL}// Comment out this line to turn this project into an ISAPI module

Turn that line into a comment to convert the project to an ISAPI DLL:

{.$define UNIGUI_VCL}// Comment out this line to turn this project into an ISAPI module

After making that change, close and reopen the project. Building the project will create a file named wsbasicchat.dll in the output folder.

We have already made all necessary settings in the previous section, so nothing else needs to be done in that regard.

clip0330
1

Convert and build the project

  • Comment out the {$define UNIGUI_VCL} line as shown above.

  • Close and reopen the project.

  • Build the project. The output will include wsbasicchat.dll.

2

Deploy the ISAPI DLL to IIS

  • Deploy the generated wsbasicchat.dll to Microsoft IIS. (See ISAPI Module for deployment details.)

  • Note: deployment procedure is the same as usual, with one important exception regarding IP bindings described next.

3

Configure site bindings to avoid conflicts

In the example test system the dedicated WebSockets server and IIS are assigned different IPs:

  • 192.168.1.5 — dedicated WebSockets server

  • 192.168.1.4 — IIS

When configuring your IIS site, explicitly bind the site to the IIS IP (192.168.1.4 in this example). This ensures there is no conflict between the IIS web application and the dedicated WebSockets server.

To do this: choose Edit Site > Bindings and bind your site to the IIS IP.

clip0299

Repeat this if your site needs a secure connection as well, or only add a secure binding if your application requires secure connections.

clip0300

After making the above adjustments your Site Bindings should look similar to this image. (In a real-world configuration you also need to specify a Host Name.)

clip0301
4

Access the deployed chat application

With the above settings, the chat application should be available at:

http://192.168.1.4/chat/wsbasicchat.dll

clip0302