Connect to Quix

The Quix SDK comes with a streaming client that enables you to connect to Quix easily, to read data from Quix, and to write data to Quix. The streaming client manages the connections between your application and Quix and makes sure that the data is delivered reliably to and from your application.

Using the streaming client involves the following steps:

  • Obtain a client certificate and credentials (security context) for your application.

  • Create a streaming client.

Set up security context

A security context consists of a client certificate, username, and password. Quix generates these automatically for you when you create a project using the templates provided on the Quix Portal. If necessary, you can download these credentials separately.

Create a streaming client

The following code shows you how to set up the SecurityOptions for your connection and how to create a StreamingClient instance to start Reading and Writing real-time time series data with Quix:

  • Python

  • C#

  • Javascript

security = SecurityOptions(CERTIFICATES_FOLDER, QUIX_USER, QUIX_PASSWORD)
client = StreamingClient('kafka-k1.quix.ai:9093,kafka-k2.quix.ai:9093,kafka-k3.quix.ai:9093', security)
var security = new SecurityOptions(CERTIFICATES_FOLDER, QUIX_USER, QUIX_PASSWORD);
var client = new Quix.Sdk.Streaming.StreamingClient("kafka-k1.quix.ai:9093,kafka-k2.quix.ai:9093,kafka-k3.quix.ai:9093", security);

Quix web APIs are secured with OAuth2.0 bearer scheme. Therefore, all HTTP requests to Quix must contain a valid bearer token. You can generate a personal access token (PAT) for use as a bearer token from the portal by following the following steps.

  • Navigate to your profile by clicking on your avatar and selecting "Profile" from the drop-down menu.

  • Select "Personal Access Tokens" tab on the profile page.

  • Click on "Generate Token" button to open a dialog to set a name and an expiry date for the PAT and click on "Create" to generate the PAT.

Store credentials securely

For your convenience, when you create a new project on the Quix platform, the credentials are generated and set in the code for you. However, it is good practice to move them out of the code to a more secure location like environment variables or a keystore, depending on your development platform.

When you deploy your application to Quix, you can store them on Quix as environment variables. Refer to deployments for more information.