eSeGeCe sgcWebSockets v4.2.5 for Delphi 10.3 Rio for Win32, Win64, Android
eSeGeCe sgcWebSockets v4.2.5 for Delphi 10.3 Rio for Win32, Win64, Android
sgcWebSockets is a complete package providing access to WebSockets protocol, allowing to create WebSockets Servers, Intraweb Clients or WebSocket Clients in VCL, Lazarus/FPC and Firemonkey applications. WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011. WebSocket is designed to be implemented in web browsers and web servers, but it can be used by any client or server application. The WebSocket protocol makes possible more interaction between a browser and a web site, facilitating live content and the creation of real-time game.
Fully functional multithreaded WebSocket server according to RFC 6455.
Supports Firemonkey (Windows, MacOS, iOS and Android).
Supports Linux 64.
Supports Lazarus / FreePascal.
Supports CBuilder.
Supports C# .NET through sgcWebSockets.dll
Supports Chrome, Firefox, Safari, Opera and Internet Explorer (including iPhone, iPad and iPod)
Binary and Full Unicode Messages Support
Message compression using PerMessage_Deflate extension.
Flash FallBack for Web Browsers without native WebSockets (like Internet Explorer 6-9).
Multiple Threads Support
Server component providing WebSocket and HTTP connections through the same port.
Client WebSocket supports connections through Socket.IO Servers.
Client WebSocket supports connections through HTTP Proxy Servers.
WatchDog and HeartBeat built-in support.
Events Available: OnConnect, OnDisconnect, onmessage, onerror
Built-in sub-protocols: JSON-RPC 2.0(Transactional Messages, PubSub, RPC, Queues, QoS and more), MQTT, Datasets, Binary Files, WebRTC and WAMP.
Built-in jР°vascript libraries to support browser clients.
Easy to setup
jР°vascript Events for a full control
Async Events using Ajax
SSL/TLS support on Server and Client components
MORE ABOUT OUR VALUE
Custom Objects
Every time a new WebSocket connection is established, sgcWebSockets creates a TsgcWSConnection class where you can access to some properties like identifier, bytes received/sent, client IP... and there is a property called Data where you can store objects in memory like database access, session objects...
Basic
implements Basic Access Authentication, only applies to VCL Websockets (Server and Client) and HTTP Requests (client webbrowsers don't implement this type of authentication). When a client tries to connect, it sends a header using AUTH BASIC specification.
Secure Connections
SSL support is based on Indy implementation, so you need to deploy openssl libraries in order to use this feature. In Compiled Demos file, there is a directory called Third-Parties/ openssl, where you can find the libraries need for every Delphi Version.
Compression
This is a feature that works very well when you need to send a lot of data, usually using a binary message, because it compresses WebSocket message using protocol "PerMessage_Deflate" which is supported by some browsers like Chrome.
Bindings
Usually Server have more than one IP, if you enable a WebSocket Server and set listening port to 80, when server starts, tries to listen port 80 of ALL IP, so if you have 3 IP, it will block port 80 of each IP's.
Bindings allows to define which exact IP and Port are used by the Server. Example, if you need to listen on port 80 for IP 127.0.0.1 (internal address) and 80.254.21.11 (public address).
Quality of Service (QoS)
SGC Default Protocol implements a QoS (Quality of Service) for message delivery, there are 3 different types:
Level 0: "At most once"
where messages are delivered according to the best efforts of the underlying TCP/IP network. Message loss or duplication can occur. This level could be used, for example, with ambient sensor data where it does not matter if an individual reading is lost as the next one will be published soon after.
Level 1: "At least once"
where messages are assured to arrive but duplicates may occur.
Level 2: "Exactly once"
where message are assured to arrive exactly once. This level could be used, for example, with billing systems where duplicate or lost messages could lead to incorrect charges being applied.
Queues
SGC Default Protocol implements Queues to add persistence to published messages (it's only available for Published messages)
Level 0
Messages are not queued on Server
Level 1
only last message is queued on Server, and is sent every time a client subscribes to a new channel or connects to server.
Level 2
All messages are queued on Server, and are sent every time a client subscribes to a new channel or connects to server.
Transactions
sgcWebSockets SGC Protocol supports transactional messaging, when a client commits a transaction, all messages sent by client are processed on server side. There are 3 methods called by client
StartTransaction
Creates a New Transaction on server side and all messages that are sent from client to server after this method, are queued on Server side, until client calls to Commit or Rollback
Commit
When a client calls to commit, all messages queued by server are processed.
RollBack
When a client calls to RollBack, all messages queued by server are deleted and not processed on server side.
HTTP
TsgcWebSocketHTTPServer is a component that allows to handle WebSocket and HTTP connections using the SAME port. Is very useful when you need to setup a server where only HTTP port is enabled (usually 80 port). This component supports all TsgcWeBSocketServer features and allows to serve HTML pages.
You can serve HTML pages statically, using DocumentRoot property, example: if you save test.html in directory "C:\inetpub\wwwroot", and you set DocumentRoot to "C:\inetpub\wwwroot". If a client tries to access to test.html, it will be served automatically, example:
http://localhost/test.html
Or you can serve HTML or other resources dynamically by code, to do this, there is an event called OnCommandGet that is fired every time a client requests a new HTML page, image, jР°vascript file...
Throttle
Bandwidth Throttling is supported by Server and Client components, if enabled, can limit the amount of bits per second sent/received by socket. Indy uses a blocking method, so if a client is limiting its reading, unread data will be inside client socket and server will be blocked from writing new data to client. As much slower is client reading data, much slower is server writing new data.
Server-Sent Events
SSE are not part of WebSockets, defines an API for opening an HTTP connection for receiving push notifications from a server.
SSEs are sent over traditional HTTP. That means they do not require a special protocol or server implementation to get working. In addition, Server-Sent Events have a variety of features that WebSockets lack by design such as automatic reconnection, event IDs, and the ability to send arbitrary events.
HeartBeat
On Server components, automatically sends a ping to all active WebSocket connections every x seconds.
On Client components, automatically sends a ping to server every x seconds.
WatchDog
On Server components, automatically restart server after unexpected disconnection.
On Client components, automatically reconnect to server after unexpected disconnection.
Proxy
Client WebSocket components support WebSocket connections through proxies
LoadBalancing
Load Balancing allows to distribute work between several back-end servers, every time a new client request a connection, it connects to a load balancer server (which is connected to back-end servers) and returns a connection string with information about host, port... which is used by client to connect to a server. If you have for example 4 servers, with this method all servers will have, more or less, the same number of connections, and work load will be similar.
If a client want to send a message to all clients of all servers, just use broadcast method, and this message will be broadcast to all servers connected to Load Balancer Server.
FallBack
Web Browsers without WebSockets support, can use Flash to connect to WebSocket Server (example: Internet Explorer from version 6 to 9).
If Flash is not enabled, then tries to connect using Server-Sent Events + XHR.
4.2.5: 2019 May
[+] : New Event AfterConnect in TsgcWSAPI_SocketIO, this event is called after socket.io connection is successful and client can send messages to server.
[+] : New Property Socket.IO Polling in TsgcWSAPI_SocketIO, disabling this property, client will connect directly to server using websocket as transport.
[+] : Updated Bitstamp API to version 2.
[+] : New Event OnCommandRequest on TsgcWSHTTPWebBrokerBridgeServer component, when server gets a new http request, this event is called and here you can customize http response.
[+] : New Property ClearReceivedStreamsOnDisconnect on Files Protocol, if disabled, when reconnects, try to resume file download for qosLevel2.
[+] : New Property ClearSentStreamsOnDisconnect on Files Protocol, if disabled, when reconnects, try to resume file upload for qosLevel2.
[+] : New Property TCPEndOfFrameScanBuffer in TsgcWSConnection class, allows to define which method use to find end of message.
eofScanNone: every time a new packet arrive, OnBinary event is called.
eofScanLatestBytes: if latest bytes are equal to bytes added with AddTCPEndOfFrame method, OnBinary message is called, otherwise this packet is buffered
eofScanAllBytes: search in all packet if find bytes equal to bytes added with AddTCPEndOfFrame method. If true, OnBinary message is called, otherwise this packet is buffered
[+] : New Method AddTCPEndOfFrame in TsgcWSConnection class, if connection is plain TCP, allows to set which byte/s define the end of message. Message is buffered till is received completely.
[+] : Updated File Protocol, now SendFile/BroadcastFile accepts FileId as parameter, if FileId is blank, will work as before, value will be assigned automatically.
: Fixed Bug Server Protocol searching channel subscriptions when channel is empty.
: Fixed Bug WriteAndWaitData method, doesn't wait in Android and iOS.
: Fixed Bug Ping with Timeout, doesn't wait in Android and iOS.
: Fixed Bug Connect method for client component, doesn't wait in Android and iOS.
: Fixed Bug Disconnect method for client component, doesn't wait in Android and iOS.
: Fixed Bug Internal Timer for QoS Level2, doesn't work after a reconnect.
: Fixed Bug Socket.IO client, if Heartbeat enabled and timeout > 0, connection always disconnect after timeout.
: Fixed Bug Server File Protocol, property files doesn't read assigned values and always use default.
: Fixed Bug File Protocol, if sending a file using qosLevel2, there was a disconnection, after reconnect, process won't continue.
: Fixed Bug MQTT Protocol decoding QoS for Publish messages.
: Fixed Bug MQTT Protocol reading Packet Identifier for Publish messages.
: Fixed Bug MQTT Protocol writing Packet Identifier when was greater than 255.
: Fixed Bug TsgcWebSocketServer_HTTPAPI, when a client send a POST method, content property was empty.
: Fixed Bug Detecting HTTP POST Header when version is 1.0.
: Fixed Bug Detecting WebSocket Header when client sends a POST with websocket headers.
: Fixed Bug during HTTP negotiation for BITTREX Component, now requires TLS 1.2 to connect to server.
: Fixed Bug SignalR API component, now HTTP negotiation takes TLS version from TLSOptions of TsgcWebSocketClient component.
: Fixed Bug CBuilder reading CleanDisconnect property, now this property is public instead of published for CBuilder.
: Fixed Bug File Server Protocol calling BroadcastFile method (abstract error) when HTTP API Server is attached.
: Fixed Bug File Server Protocol, list index out of bounds processing acknowledgment.
[+] : New Event AfterConnect in TsgcWSAPI_SocketIO, this event is called after socket.io connection is successful and client can send messages to server.
[+] : New Property Socket.IO Polling in TsgcWSAPI_SocketIO, disabling this property, client will connect directly to server using websocket as transport.
[+] : Updated Bitstamp API to version 2.
[+] : New Event OnCommandRequest on TsgcWSHTTPWebBrokerBridgeServer component, when server gets a new http request, this event is called and here you can customize http response.
[+] : New Property ClearReceivedStreamsOnDisconnect on Files Protocol, if disabled, when reconnects, try to resume file download for qosLevel2.
[+] : New Property ClearSentStreamsOnDisconnect on Files Protocol, if disabled, when reconnects, try to resume file upload for qosLevel2.
[+] : New Property TCPEndOfFrameScanBuffer in TsgcWSConnection class, allows to define which method use to find end of message.
eofScanNone: every time a new packet arrive, OnBinary event is called.
eofScanLatestBytes: if latest bytes are equal to bytes added with AddTCPEndOfFrame method, OnBinary message is called, otherwise this packet is buffered
eofScanAllBytes: search in all packet if find bytes equal to bytes added with AddTCPEndOfFrame method. If true, OnBinary message is called, otherwise this packet is buffered
[+] : New Method AddTCPEndOfFrame in TsgcWSConnection class, if connection is plain TCP, allows to set which byte/s define the end of message. Message is buffered till is received completely.
[+] : Updated File Protocol, now SendFile/BroadcastFile accepts FileId as parameter, if FileId is blank, will work as before, value will be assigned automatically.
Only for V.I.P
Warning! You are not allowed to view this text.