API problem at KR-Mirae Aseet Daewoo

Hi.
One of client has API issue and I am not familiar with API.. Could anyone check and give guide?
While configuring with Sample, client had the issue (below is sample and client's comment)
-------------------------------------------------------------------------------------------------------
try {
// Connect to Refinitiv Data Platform and authenticate (using our username and password)
authJson = getAuthenticationInfo(null); => Token created(New)
if (authJson == null)
System.exit(1);
// Determine when the access token expires. We will re-authenticate before then.
int expireTime = Integer.parseInt(authJson.getString("expires_in")); => Looks expired Token every 10mins
server = String.format("wss://%s:%s/WebSocket", hostname, port);
System.out.println("Connecting to WebSocket " + server + " ...");
ws = connect(); => WebSocket connects, Refinitiv data could be retrieved
while(true) {
// Continue using current token until 90% of initial time before it expires.
// The value 900 means 90% of expireTime in milliseconds
Thread.sleep(expireTime * 900); => 600*900=540000ms=5400sec=90min, sleep for 90min
While this period, socket was closed and connection was terminated due to Token was expired (Deleted 'sleep' because of this issue)
// Connect to Refinitiv Data Platform and re-authenticate, using the refresh token provided in the previous response
authJson = getAuthenticationInfo(authJson); => Verifying Token(Looks checking existing Toketn) but, no changed. Aslo, due time was not reduced. Looks meaningless to check
if (authJson == null)
System.exit(1);
// If expiration time returned by refresh request is less then initial expiration time,
// re-authenticate using password
int refreshingExpireTime = Integer.parseInt(authJson.getString("expires_in"));
if (refreshingExpireTime != expireTime) { => Always 600=600, In short, do not go 'if' query
System.out.println("expire time changed from " + expireTime + " sec to " + refreshingExpireTime +
" sec; retry with password");
authJson = getAuthenticationInfo(null);
if (authJson == null)
System.exit(1);
expireTime = Integer.parseInt(authJson.getString("expires_in"));
}
// Send the updated access token over the WebSocket.
sendLoginRequest(ws, authJson.getString("access_token"), false); => Login Failed : Login rejected. Already Pending login. Error happened
}
} catch (IOException e) {
e.printStackTrace();
} catch (WebSocketException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
-------------------------------------------------------------------------------------------------------
So, client asked below
"Client original query"
Related with previou isuse, they modified by themselves, so, when failed login, if tihs is caused by expiring, it forcely re-create token.
> But, in result, Token is re-created every 10 mins with message token has expired.
> And they found Websocket also closed continuously.
> So, they checked by "WebSocket.getState()", if it is not OPEN, connect newly by ws = connect();
> And if do this, below issue happened again.
b
Need to check why token is expired, why WebSocket is disconnected.
And for this, guided "
https://community.developers.refinitiv.com/questions/80491/rto-disconnect-with-ema-java.html " to set logs for detail information
And now, client asked again below.
1. Create the logging.properties file with the following content in the working directory
"What is working directory? Directory which is .java file located? or Directory which is lib files imprted?"
2. Add the XmlTraceToStdout configuration to the Consumer in the EmaConfig.xml. The following example adds the XmlTraceToStdout configuration to the Consumer_4 which is used to connect to RTO.
"Where is EmaConfig.xml file located?"
"As below Sample, called java by importing lib. Dont't use this .xml"
(Sample1) https://github.com/Refinitiv/websocket-api/tree/master/Applications/Examples/RDP
In short,
Solution for : Authentication server did not contail "active" in responseo
is best and if need more information, could help how to set below?
"And now, client asked again below.
1. Create the logging.properties file with the following content in the working directory
"What is working directory? Directory which is .java file located? or Directory which is lib files imprted?"
2. Add the XmlTraceToStdout configuration to the Consumer in the EmaConfig.xml. The following example adds the XmlTraceToStdout configuration to the Consumer_4 which is used to connect to RTO.
"Where is EmaConfig.xml file located?"
"As below Sample, called java by importing lib. Dont't use this .xml"
(Sample1) https://github.com/Refinitiv/websocket-api/tree/master/Applications/Examples/RDP"
Many Thanks.
Best Answer
-
Hello @junggil.park1
Based on the given information, the client is using the WebSocket API, not the RTSDK/EMA Java API, and the code is based on the RTO WebSocket API - MarketPriceRdpGwServiceDiscovery example. If so, the application does not use the EmaConfig.xml and the logging.properties files. The application needs to log all HTTP Rest and WebSocket JSON messages by itself.
Please be informed that the RTO uses RDP authentication. The authentication token (access token) is a short-lived token that always expires every "expires_in" seconds. When the RDP access token expires, the RTO WebSocket server cuts the connection. You can keep the WebSocket connection alive via the following steps:
- Re-authenticate with the RDP using a refresh token before token expiration to get a new token
- Re-issue login request to the RTO WebSocket server with a new access token before token expiration to keep session open.
The other important thing is you need to send a Pong message back to the server if the server sends a Ping message to the application. These ping-pong messages act as a heartbeat mechanism between the client and server. I suggest the client runs the RTO MarketPriceGrdpGwServiceDiscovery example (https://github.com/Refinitiv/websocket-api/blob/master/Applications/Examples/RDP/java/MarketPriceRdpGwServiceDiscovery.java) "as is" to see the RDP/RTO behavior in detail.
Additionally, the client can find more detail regarding the RTO Token behavior from the following resources:
- WebSocket API Tutorial - Connect to Refinitiv Real-Time - Optimized
- RDP APIs - Authorization - All about tokens
- RDP APIs - Authorization in Python
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 280 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 716 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛