Hi Everybody,

I have a WebSockets server based on ICS. It is currently implemented as a
tcp-server (TWSocketServer without any modifications) with custom
descendant of TWSocketClient, which provides all necessary functionality
for WebSockets handshaking and data exchange.

We could use it in ICS projects right away, but I'm not sure if this is a proper
approach.

Lets consider an ordinary use-case for websockets: a client is a browser's
built-in websocket, and the socket is instantiated by a web-page code.
The web-page itself is normally served by a web-server located on the same
host which is an endpoint of the websocket connection. So, standard http-
port is used by the web-server, and a dedicated tcp-server (for websockets)
is required to listen at a non-standard port, which may be not allowed by
some firewalls. On the other hand, we can suppose that the web-server is
an ICS-based web-server. So, it is feasible to combine web-server and
websockets-server in a single component, serving websockets on standard
http-port. I think, this is only possible if the current THttpServer component
(actually, meaning with the THttpConnection component) is extended
and reworked. That is deriving new components from the existing ones
will require overriding of most important virtual methods and copy-pasting
much of http-related code into the new methods, what is not good. The reason
for this is the need to interlace little yet distinctive websocket code 
fragments
with existing code. In other words, it would be necessary anyway to transform
such methods as THttpConnection.ConnectionDataAvailable into a highly
templatized methods splitted into several new virtual stages/branches each.

Are there some other design principles for implementing this?

I'd be glad to hear your opinions, considerations on which variant is the best,
and suggestions on implementation.

If the general consesus is that current design is sufficient for the moment,
I'll send the sources to Francois.

Best wishes,
Stan

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to