TsgcWebSocketHTTPServer

AResponseInfo.

Introduction

TsgcWebSocketHTTPServer implements Server WebSocket Component and can handle multiple threaded client connections as TsgcWebSocketServer, and allows you to serve HTML pages using a built-in HTTP Server, sharing the same port for WebSocket connections and HTTP requests.

 

Follow the steps below to configure this component:

 

1. Drop a TsgcWebSocketHTTPServer component in the form

 

2. Set Port (default is 80). If you are behind a firewall probably you will need to configure it.

 

3. Set Specifications allowed, by default, all specifications are allowed.

 

    RFC6455: is standard and recommended WebSocket specification.

 

    Hixie76: it's a draft and it's only recommended to establish Hixie76 connections if you want to provide support to old browsers like Safari 4.2

 

AResponseInfo.ContentText := '<HTML><HEADER>TEST</HEAD><BODY>Hello!</BODY></HTML>';

 

      OnHTTPUploadBeforeCreatePostStream: this event is called after the headers have been read and before the post stream is created.

 

* In some cases, you may get a high consume of cpu due to unsolicited connections, in these cases, just return an error 500 if it's a HTTP request or close connection for Unknown Protocol requests.

 

5. Create a procedure and set property Active = true.

 

Reference

Guides