How to use PUBQ?
There are two methods available to integrate PUBQ into your stack. You can choose to use a PUBQ SDK or opt for an integration using APIs to establish communication between PUBQ and your clients or trusted devices. This documentation page outlines the available options in detail.
PUBQ SDKs
PUBQ SDKs provide a consistent and idiomatic API across a variety of supported platforms and are the most feature-rich method of integrating PUBQ into an application. PUBQ SDKs contain a realtime and a REST interface, each of which can be used to satisfy different use cases.
REST interface
The REST interface communicates with the PUBQ service using the HTTP protocol and is effectively stateless. The REST interface provides a convenient way to access the REST HTTP API and is intended to be used by clients that don’t require realtime updates. It is more commonly used server-side. It is used to:
- Publish messages
- Issue tokens on behalf of other realtime clients
Realtime interface
The realtime interface is implemented using a PUBQ-defined protocol, primarily over WebSockets. It enables clients to establish and maintain a persistent connection to PUBQ. The realtime interface extends the functionality of the REST interface and is most commonly used client-side. It is used to:
- Maintain a persistent connection to PUBQ
- Subscribe channels and receive their messages
- Publish at very high message rates, or with the lowest possible realtime latencies
PUBQ APIs
To interact with PUBQ, using APIs is recommended for the following reasons:
- No SDK available for your preferred programming stack: If PUBQ does not provide a software development kit (SDK) specifically designed for your preferred programming language or framework, using APIs allows you to still integrate with PUBQ and leverage its functionalities.
- Use of preferred HTTP/WebSocket client: By utilizing APIs, you have the flexibility to use your preferred HTTP or WebSocket client libraries to interact with PUBQ. This ensures that you can work with familiar tools and maintain consistency within your development environment.
- Lightweight Integration: Using API can be more lightweight compared to incorporating an SDK, which might include additional features that you don't want. If resource usage is a concern, a direct API call might be more efficient.
WebSocket API
Interacting with the realtime APIs directly over WebSockets is fully supported. However, PUBQ recommends using the realtime interface of an SDK where possible, as they provide additional features that improve performance and resilience that the WebSocket API can’t deliver on its own.
REST HTTP API
Interacting with the REST HTTP API directly is fully supported. However, PUBQ recommends using the REST interface of an SDK where possible, as they provide additional features that improve performance and resilience that the REST HTTP API can’t deliver on its own.