16#ifndef INCLUDED_Lightstreamer_LightstreamerClient
17#define INCLUDED_Lightstreamer_LightstreamerClient
19#include "../Lightstreamer.h"
20#include "Lightstreamer/LoggerProvider.h"
21#include "Lightstreamer/Subscription.h"
22#include "Lightstreamer/ConnectionOptions.h"
23#include "Lightstreamer/ConnectionDetails.h"
24#include "Lightstreamer/LightstreamerError.h"
26namespace Lightstreamer {
61 static const char*
initialize(
void (*unhandledExceptionCallback)(
const char *exceptionInfo) =
nullptr) {
62 return Lightstreamer_initializeHaxeThread(unhandledExceptionCallback);
77 Lightstreamer_stopHaxeThreadIfRunning(
true);
83 return LightstreamerClient_getLibName();
89 return LightstreamerClient_getLibVersion();
128 LightstreamerClient_setLoggerProvider(provider);
149 static void addCookies(
const std::string& uri,
const std::vector<std::string>& cookies){
150 LightstreamerClient_addCookies(&uri, &cookies);
163 static std::vector<std::string>
getCookies(
const std::string& uri) {
164 return LightstreamerClient_getCookies(&uri);
177 static void setTrustManagerFactory(
const std::string& caFile,
const std::string& certificateFile,
const std::string& privateKeyFile =
"",
const std::string& password =
"",
bool verifyCert =
true) {
178 LightstreamerClient_setTrustManagerFactory(&caFile, &certificateFile, &privateKeyFile, &password, verifyCert);
220 _client = LightstreamerClient_new(&serverAddress, &adapterSet);
226 LightstreamerClient_disconnect(_client);
227 Lightstreamer_releaseHaxeObject(_client);
243 if (listener ==
nullptr)
245 LightstreamerClient_addListener(_client, listener);
260 if (listener ==
nullptr)
262 LightstreamerClient_removeListener(_client, listener);
271 return LightstreamerClient_getListeners(_client);
296 LightstreamerClient_connect(_client);
313 LightstreamerClient_disconnect(_client);
339 return LightstreamerClient_getStatus(_client);
361 if (subscription ==
nullptr)
363 LightstreamerClient_subscribe(_client, subscription->_delegate);
379 if (subscription ==
nullptr)
381 LightstreamerClient_unsubscribe(_client, subscription->_delegate);
393 return LightstreamerClient_getSubscriptions(_client);
463 void sendMessage(
const std::string& message,
const std::string& sequence =
"",
int delayTimeout = -1,
ClientMessageListener* listener =
nullptr,
bool enqueueWhileDisconnected =
false) {
464 LightstreamerClient_sendMessage(_client, &message, &sequence, delayTimeout, listener, enqueueWhileDisconnected);
Interface to be implemented to listen to LightstreamerClient events comprehending notifications of co...
Definition ClientListener.h:32
Interface to be implemented to listen to LightstreamerClient#sendMessage events reporting a message p...
Definition ClientMessageListener.h:31
Used by LightstreamerClient to provide a basic connection properties data object.
Definition ConnectionDetails.h:33
Used by LightstreamerClient to provide an extra connection properties data object.
Definition ConnectionOptions.h:33
Facade class for the management of the communication to Lightstreamer Server.
Definition LightstreamerClient.h:49
std::vector< Subscription * > getSubscriptions()
Inquiry method that returns a list containing all the Subscription instances that are currently "acti...
Definition LightstreamerClient.h:392
static void addCookies(const std::string &uri, const std::vector< std::string > &cookies)
Static method that can be used to share cookies between connections to the Server (performed by this ...
Definition LightstreamerClient.h:149
static void setLoggerProvider(LoggerProvider *provider)
Static method that permits to configure the logging system used by the library.
Definition LightstreamerClient.h:127
std::vector< ClientListener * > getListeners()
Returns a list containing the ClientListener instances that were added to this client.
Definition LightstreamerClient.h:270
ConnectionDetails connectionDetails
Data object that contains the details needed to open a connection to a Lightstreamer Server.
Definition LightstreamerClient.h:195
static std::string libVersion()
The version of the library.
Definition LightstreamerClient.h:88
static std::string libName()
The name of the library.
Definition LightstreamerClient.h:82
void subscribe(Subscription *subscription)
Operation method that adds a Subscription to the list of "active" Subscriptions.
Definition LightstreamerClient.h:360
void unsubscribe(Subscription *subscription)
Operation method that removes a Subscription that is currently in the "active" state.
Definition LightstreamerClient.h:378
static std::vector< std::string > getCookies(const std::string &uri)
Static inquiry method that can be used to share cookies between connections to the Server (performed ...
Definition LightstreamerClient.h:163
void sendMessage(const std::string &message, const std::string &sequence="", int delayTimeout=-1, ClientMessageListener *listener=nullptr, bool enqueueWhileDisconnected=false)
Operation method that sends a message to the Server.
Definition LightstreamerClient.h:463
ConnectionOptions connectionOptions
Data object that contains options and policies for the connection to the server.
Definition LightstreamerClient.h:187
void removeListener(ClientListener *listener)
Removes a listener from the LightstreamerClient instance so that it will not receive events anymore.
Definition LightstreamerClient.h:259
static void stop()
Stops the Lightstreamer thread, blocking until the thread has completed.
Definition LightstreamerClient.h:76
static const char * initialize(void(*unhandledExceptionCallback)(const char *exceptionInfo)=nullptr)
Initializes a thread that executes the Lightstreamer functions.
Definition LightstreamerClient.h:61
void disconnect()
Operation method that requests to close the Session opened against the configured Lightstreamer Serve...
Definition LightstreamerClient.h:312
void connect()
Operation method that requests to open a Session against the configured Lightstreamer Server.
Definition LightstreamerClient.h:295
std::string getStatus()
Inquiry method that gets the current client status and transport (when applicable).
Definition LightstreamerClient.h:338
static void setTrustManagerFactory(const std::string &caFile, const std::string &certificateFile, const std::string &privateKeyFile="", const std::string &password="", bool verifyCert=true)
Provides a mean to control the way TLS certificates are evaluated, with the possibility to accept unt...
Definition LightstreamerClient.h:177
void addListener(ClientListener *listener)
Adds a listener that will receive events from the LightstreamerClient instance.
Definition LightstreamerClient.h:242
LightstreamerClient(const std::string &serverAddress="", const std::string &adapterSet="")
Creates an object to be configured to connect to a Lightstreamer server and to handle all the communi...
Definition LightstreamerClient.h:219
The LightstreamerError class provides a base class for exceptions thrown by the library.
Definition LightstreamerError.h:27
Simple interface to be implemented to provide custom log consumers to the library.
Definition LoggerProvider.h:29
Class representing a Subscription to be submitted to a Lightstreamer Server.
Definition Subscription.h:71