Jump to content
Andrii

Web sockets server and client

Recommended Posts

Dear authors and community.

I'd like to use Websockets using ICS library. I know it's not a part of the library but probably someone could share his own implementation or may be has already found in the internet.

 

Thanks in advance.

 

Andrii.

Share this post


Link to post
9 hours ago, Andrii said:

Dear authors and community.

I'd like to use Websockets using ICS library. I know it's not a part of the library but probably someone could share his own implementation or may be has already found in the internet.

 

Thanks in advance.

 

Andrii.

from other post

Quote

There is a Websockets project at https://github.com/fajar-khairil/ics-websockets by Stan Korotky, dating back to 2012, but it is not SSL enabled.  From the demo server comments:

 

Basic websockets server based on TWSocketServer and TWSocketClient components, and websockets implementation ported from phpws project (http://code.google.com/p/phpws/). Derived from TCP server demo V7.02, by François PIETTE.

 

Been meaning to incorporate it into ICS for a while, never had the time or a suitable project to test it with.

 

Angus

 

Share this post


Link to post

I will do a quick evaluation of building that old code with the latest ICS over the next few days, but I won't do anything further unless someone else sets up a websockets test environment to test it all, that often takes as long as the coding, a server and client that the ICS components can be separately tested against.

 

Angus

 

  • Like 1

Share this post


Link to post

Could you clarify what is the websockets test environment?

2 hours ago, Angus Robertson said:

I will do a quick evaluation of building that old code with the latest ICS over the next few days, but I won't do anything further unless someone else sets up a websockets test environment to test it all, that often takes as long as the coding, a server and client that the ICS components can be separately tested against.

 

Angus

 

 

Share this post


Link to post
6 hours ago, nouvakis said:

from other post

 

As far as I got this example is just a websockets server implementation. I did not understand how to build a websockets client (not javascript but Delphi).

Share this post


Link to post

Websockets is a client server protocol, like HTTP, except once the connection is open duplex packets can be sent back and forward.  So that packet stuff is common to client and server, and exists in the old code using ICS.  The sample application is just a server and a JavaScript client web page.  But creating an ICS client should not be hard, uses HTTP and the same functions as the server.

 

Angus

 

 

Share this post


Link to post

I have an alternative implementation here,

it is build with the larger xxm project, which is primarily designed to be a 'generic' layer between IIS, Apache https, CGI or SCGI, and provides a way to use the very same binary with any of these.

Regretfully, not all environments (and their xxm handler) support websockets. xxm has a bare-bones HTTP service as well which till now offers the best performance (but no TLS, compression or even logging...)

if you specifically want to work with websockets, see the example project here also.

  • Like 1

Share this post


Link to post

I've updated the ICS distribution with the Websocket server implementation (HIXIE and HYBIE protocols) ported from phpws project, written by Stan Korotky <stasson@orc.ru> (eight years ago).

 

This demo may be tested against the  web page websocketclient.html which should be accessed from a server using the same IP address as this application, such as the ICS demo web server.  The web page uses the
WebSocket API with Javascript to send data to the server which is echoed back to the page.

 

Ideally, websockets should be integrated into the ICS web server so they can be used on the same ports, the request that starts them up is HTTP, and I'll do that is anyone needs it. 

 

Please note this is an experimental server websocket implementation, that needs a lot more testing in case the protocol has changed in the last eight years.  But it works with the latest version of Firefox as a client.

 

A websockets client component is more work, but using most of the same code as the server since it's a duplex protocol. 

 

Angus

  • Thanks 2

Share this post


Link to post
2 hours ago, Angus Robertson said:

Ideally, websockets should be integrated into the ICS web server so they can be used on the same ports, the request that starts them up is HTTP, and I'll do that is anyone needs it. 

Angus

It would be great.

Share this post


Link to post

I am also looking for a simple websocket implementation between server and client just to transfer strings. I have come cross mormot, trying it out. 

 

I would be interested if you have already done using other methods. 

Share this post


Link to post

Websockets are designed for use in browsers, as a more efficient duplex mechanism than Ajax, for interactive content like spell check and auto completion as you type.  

 

Don't see any purpose outside the browser environment where simple TCP client/server has been used for 30 years.  ICS has several sockets demos illustrating various client/server concepts. 

 

Angus

 

Share this post


Link to post
4 minutes ago, Angus Robertson said:

Websockets are designed for use in browsers, as a more efficient duplex mechanism than Ajax, for interactive content like spell check and auto completion as you type.  

 

Don't see any purpose outside the browser environment where simple TCP client/server has been used for 30 years.  ICS has several sockets demos illustrating various client/server concepts. 

 

Angus

 

I'd add that sometimes UDP more reliable in some configuration eg. when a client is behind a router connecting to outer world. But the source of my question is heterogeneity of clients in my specific client/server configuration: Android App, Delphi 7 App, Web browser. It's kind of monitoring system having various UIs watching changes. Of course it's possible to implement 3 different approaches of data exchange but I'd like to use uniform. So my concern is still one of 3 options: HTTP polling, Web sockets or mix of UDP/HTTP. Obviously, I'd never use Delphi 7 as a backend but it's a requirement of the legacy system.

Share this post


Link to post

There is nothing wrong with Delphi 7 for applications today, if anything they are less bloated than later compilers where EXEs just get bigger with no extra functionality, All my ICS development and commercial applications are Delphi 2007, but then tested and made compatible with the latest and greatest of the day.  Obviously cross platform development is another matter, but I don't do that.  And lots of new language features and library functions, which ICS seems to manage without, or has implemented it's own versions to be compatible across all compilers D7 up. 

 

For client/server, also look at the new ICS component TIcsIpStrmLog and sample OverbyteIcsIpStmLogTst, the component can be configured as TCP/UDP/Client/Server with SSL/TLS, and mainly just sends lines of text back and forward, with two methods to connect/listen and send and one event to receive, you can build client/server apps very quickly. 

 

Angus

 

 

 

 

 

  • Like 1

Share this post


Link to post
5 hours ago, Angus Robertson said:

There is nothing wrong with Delphi 7 for applications today, if anything they are less bloated than later compilers where EXEs just get bigger with no extra functionality, All my ICS development and commercial applications are Delphi 2007, but then tested and made compatible with the latest and greatest of the day.  Obviously cross platform development is another matter, but I don't do that.  And lots of new language features and library functions, which ICS seems to manage without, or has implemented it's own versions to be compatible across all compilers D7 up. 

 

For client/server, also look at the new ICS component TIcsIpStrmLog and sample OverbyteIcsIpStmLogTst, the component can be configured as TCP/UDP/Client/Server with SSL/TLS, and mainly just sends lines of text back and forward, with two methods to connect/listen and send and one event to receive, you can build client/server apps very quickly. 

 

Angus

 

 

 

 

 

Thanks for suggestions, I'll definitely try the component that you mentioned.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×