sgcWebSockets as TCP Server and Client

By default, sgcWebSockets library use WebSockets as protocol, but from version sgcWebSockets 4.2.0 you can configure library to work as plain TCP Server and Client.

 

Client

There is a property in client component called: Specifications.RFC6455, by default is active. If you disable this property and try to connect to a server, client will use plain TCP protocol.

 Client.Specifications.RFC6455 := False;

 

Server

 

Every time a new connection is created in server, server tries to identify if it's a websocket connection, HTTP request... if a connection can't be identified, by default is closed. You can use OnUnknownProtocol event to accept none websocket connections

 procedure OnUnknownProtocol(Connection: TsgcWSConnection; var Accept: Boolean);

begin

  Accept := True;

end;