Skip to content

Initialization and connection to web socket api

kncsolutions edited this page Aug 16, 2018 · 6 revisions

The GfeedClient class is the main entry point to the dhelm-gfeed-client library.
To establish the connection with web socket api you have to create an instance of this class.
See the following sample:
GfeedClient gc=new GfeedClient("WEB SOCKET ENDPOINT URL","API KEY");

"WEB SOCKET ENDPOINT URL"-You will get on subscription.
"API KEY"-Your api key to connect to the web socket.

On successful connection you will get "Authentication Complete!" message. If there is an error during the connection, it will throw WebSocketException. However, the system will automatically try to reconnect a number of times.

Once the connection has been successfully established, you can call different methods to get necessary data in formatted manner as per your subscription.