Use the websocket API in synchronous mode

What is the best way to get a price snapshot synchronously.
What I would like:
ws.send(request)
result = ws.recv()
The problem is that I can receive different messages (ping for instance..).
Do I have to necessarily implement a logic to filter the answers ?
Best Answer
-
@chbailly The websocket is a connection oriented API, and there is minimal housekeeping that has to be performed - like login before making a data request, and responding to ping requests. These have to be done, regardless of request for snapshot or streaming data.
We don't have a synchronous access helper for it, but might consider providing such "ease of use library" in future. For now, please see the implementation details in the provided code samples.
0
Answers
-
I realised that I was not in snapshot mode..
So now I think I do not have to filter the answers, I am supposed to receive the answer directly, no need to filter (no ping for instance)
0 -
Thanks for your answer.
Are you saying that potentially I can receive a ping even in snapshot mode ?
The code is not straightforward.. We have to match the correct request, the error management is also made more complicated. What do we do if we do not fintd the matching request, how do we set a timeout..; This is really easy to write an incorrect code even if it looks simple.
An helper would really be a good idea imho. Sometimes, we just need to write simple and basic code. 2 lines, the send followed by the rcv...
0 -
Yes, as long as the connection is held open, ping messages are sent to asset that TCP connection is still open. This would happen regardless of snapshot or any request for data.
The websockets is a protocol specification, rather than an API, and protocol requires that application start with a login and maintain ping/pong messages.
0 -
I agree, it makes sense; thanks
0 -
Hhi - just checking to see if any decision had been made on a synchronous access helper as yet and iff there was any potential eta for it?
Many thanks
Ranjit
0 -
@ranjit.talukdar You can take a look for Websocket examples in the TR API Samples github repository - specifically the Quote Widget, which uses the TRWebsocketController. This controller sample is in Javascript and can be used as a helper object in your own implementations.
0 -
Thanks @Gurpreet but do you have anything in python?
0 -
@Gurpreet - also this looks to be for streaming data as opposed to snapshot
0 -
@ranjit.talukdar We don't have anything for python yet. I will try to produce a minimal sample and let you know.
0 -
@Gurpreet - Hi - just wopndering if u had any luck as yet.
many thanks in advance.
0 -
Hi @ranjit.talukdar, We are working on a library. It will be a few weeks before an early beta version can be shared with community.
0 -
that would be great - many thanks @Gurpreet
0 -
Hi @Gurpreet
Just wondering if the beta version of the library is ready as yet?
0 -
No, we are targeting the library to work across different platforms, and the library interface is not finalized yet.
0 -
0
-
Hi @ranjit.talukdar, As of now, it we are targeting Q1 2019.
Meanwhile, is there any coding help we can provide to get you going with your project?
0 -
Given
we use WebSockets instead of linking against a library, will this result in an
update JSON API?Will synchronous data will be added to the Q1 2019 version?
0 -
@Gurpreet - Hi any news please?
0 -
Unfortunately it is still under development, and even so, it only has asynchronous request features in implementation so far.
0 -
@Gurpreet Any chance of an eta at least of when synchronous will be added? - I believe you have been working on this since September of last year..
0 -
The python version of library will be officially supported, and development team is working on it. The scope of library is not just websockets, but other mechanisms as well.
I am not involved with its development and don't have any ETA.
I think we should close this thread. If you have any questions about the API, please start a new thread.
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
- 719 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 中文论坛