Delphi PKCE OAuth2

From sgcWebSockets 2024.5.0 PKCE, which stands for "Proof of Key Code Exchange" is an extension of the OAuth 2.0 protocol that helps prevent code interception attacks. PKCE is supported on OAuth2 Server and Client Components. What is PKCE PKCE (Proof Key for Code Exchange) is an OAuth 2.0 security enhancement designed to protect against a...

Continue reading

OpenSSL 1.1 and 3.*

While the openSSL libraries 1.0 and 1.1 are not receiving any more updates, users should consider to use the latest openSSL 3.0 or 3.1 APIs.  Find below the differences between 3.0 and 3.1: OpenSSL 3.0 is a Long Term Support version and will be supported till 7th September 2026.OpenSSL 3.1 will be supported till 14th March 2025....

Continue reading

HTTP/2 Server Threads

From sgcWebSockets 2024.2.0 the HTTP/2 server has been improved when receiving HTTP/2 requests. Now, by default, when the server receives a new HTTP/2 request, this is queued and dispatched by one of threads of the Pool of Threads. This avoid the problem when several requests are sent using the same connection and those are processed sequentially. ...

Continue reading

Delphi Indy Server EC Certificates

Indy supports RSA and EC Certificates when using the openSSL libraries, but by default, the EC certificates can be created different curves and the openSSL libraries only are configured with some of these curves. So if you're using an EC Certificate that it's not included by the default by the openSSL libraries, the certificate won't work...

Continue reading

Azure IoT Upload Files

Azure IoT allows to send data using several protocols like MQTT or AMQP, but in some cases, the size of the message is too big and requires to upload files to Azure Servers. To provide a solution to this issue IoT hub facilitates file uploads from connected devices by providing them with shared access signature (SAS) URIs on a per-upload basis...

Continue reading

Azure OpenAI Service for Rad Studio

From sgcWebSockets 2023.7.0 the Microsoft Azure OpenAI Service is supported.  Azure OpenAI Service can be used to create chatbots, generate text, translate languages, and write different kinds of creative content. As the platform continues to evolve, developers will be able to use it to build even more powerful and sophisticated applications. ...

Continue reading

Customizing OpenAI with your Data (2 / 2)

In a previous post, we see how to use OpenAI Embeddings to add contextual information to OpenAI chat methods. Now, we'll see how to use the TsgcOpenAIEmbeddings component from sgcWebSockets package to build AI applications using our own data. In the post Delphi Voice ChatBot, we used the component TsgcAIOpenAIChatBot to build a ChatBot handled...

Continue reading

Customizing OpenAI with your Data (1 / 2)

When we ask to OpenAI a question that requires some specific context, example: Who is my father? OpenAI can either hallucinate or answer that he doesn't know. To help OpenAI answer specific questions, you can provide extra contextual information in the prompt itself. My father lives in Barcelona and is 50 year's old. If we ask again to openAI the s...

Continue reading

Image Generator OpenAI Delphi (5 / 5)

OpenAI API allows given a prompt and/or an input image, the model will generate a new image. The Images API provides three methods for interacting with images:1. Creating images from scratch based on a text prompt2. Creating edits of an existing image based on a new text prompt3. Creating variations of an existing image Image Generator Delphi ...

Continue reading

Translate OpenAI Delphi Client (4 / 5)

Translating Audio to Text is very easy using the OpenAI API, just upload an Audio file in one of the following formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. And the API will translate the audio to English. Translation Delphi Example OpenAI requires to build a request were you pass the audio file, the model, the temperature (to get a more ore le...

Continue reading

Transcription OpenAI Delphi Client (3 / 5)

Transcribing Audio to Text (also known as Speech to Text) is very easy using the OpenAI API, just upload an Audio file in one of the following formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. And the API will return the string. Transcription Delphi Example OpenAI requires to build a request were you pass the audio file, the model, the te...

Continue reading

ChatGPT Delphi Client (2 / 5)

OpenAI API allows to build your own AI Chats using ChatGPT Turbo. Using the sgcWebSockets library is very easy to interactuate with the API, given a chat conversation, the model will return a chat completion response.  ChatGPT Delphi Example OpenAI requires to build a request were you pass the messages to sent to ChatGPT Turbo, the temper...

Continue reading

OpenAI Delphi API (1 / 5)

From sgcWebSockets 2023.3.0 the OpenAI API is fully supported. The OpenAI API can be applied to virtually any task that involves understanding or generating natural language, code, or images. OpenAI offer a spectrum of models with different levels of power suitable for different tasks, as well as the ability to fine-tune your own custom models. The...

Continue reading

OpenAPI Delphi Parser

I am happy to announce the sgcOpenAPI Pascal Parser, a brand new product allowing import an OpenAPI Specification and generate a Pascal Interface. The sgcOpenAPI Parser supports the following specifications: OpenAPI 3.*Swagger 2.* (automatically converted from 2.0 to 3.0)Swagger 1.* (automatically converted from 1.0 to 3.0) Supports the follow...

Continue reading

Delphi Server Sent Events (SSE) Client

From sgcWebSockets 2023.2.0 the HTTP/1 Client has been improved and supports SSE requests. Remember than SSE was already supported on Server components but not on client. SSE (Server-Sent Events) is a web technology for efficiently receiving push notifications from a server to a client's browser. It's a standard that allows a web page to receive up...

Continue reading

Mapping Groups and Connections

In a previous post I Introduced the new Groups feature on WebSocket Servers. This post I will show how to combine the WebSocket Groups with the Client Connections to identify and store the user data in a client connection. sgcWebSockets library allows you to create your own objects and link to a TsgcWSConnection class, so you can access at any time...

Continue reading

WebSocket Groups: Channels, Users and more

From sgcWebSockets 2023.2.0 a new feature has been implemented to improve Server Message Broadcasting. Groups is a new feature in sgcWebSockets library, that allows you to organize connections (representing clients, such as browsers) into named groups. This allows you to broadcast messages to all connections in a group instead of sen...

Continue reading

Indy Servers - EPOLL Linux (3 / 3)

From sgcWebSockets 2022.9.0 there is a new IOHandler for Linux, using EPOLL you can avoid the "one-thread-per-client" problem where the performance decrease a lot as more connections are handled by the server. IOCP provides a few threads that handle multiple clients. The threads are suspended and don't use CPU cycles until there is something t...

Continue reading

Indy Servers - IOCP Windows (2 / 3)

From sgcWebSockets 2022.9.0 the Indy Server IOCP IOHandler has been rewritten from scratch and performance improved. The IOCP IOHandler is only available on sgcWebSockets Enterprise Package. Using IOCP you can avoid the "one-thread-per-client" problem where the performance decrease a lot as more connections are handled by the server. IOCP provides ...

Continue reading

Indy Servers - Thread Model (1 / 3)

Indy Servers use threads to handle the client connections, every time a new client connects to the server, a new thread is created and this thread handles the connection, so if you have 100 connections, there will be 100 threads. Additionally, indy uses blocking sockets, which means when you read or write, the function doesn't return until it is co...

Continue reading