For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

Problem Login to WebSocket API

Using a Windows C# test program, we are getting reliable Authentication responses from api.ppe.refinitiv.com.

We are now trying to login to the WebSocket API at ws://api.ppe.refinitiv.com:15000/WebSocket.using the WebSocketSharp.WebSocket (1.0.3-rc11) which is connecting and appears to be sending:

GET /WebSocket HTTP/1.1

User-Agent: websocket-sharp/1.0

Host: api.ppe.refinitiv.com:15000

Upgrade: websocket

Connection: Upgrade

Sec-WebSocket-Key: xxxxxxx

Sec-WebSocket-Protocol: tr_json2

Sec-WebSocket-Version: 13

Cookie: ApplicationId=256; AuthenticationToken=xxxxxxx

Note the AuthenticationToken is truncated.

After a few seconds of connect, the WebSocket is abruptly closed with the error code 1006 and reason '"An exception has occurred while connecting."'.

We have also set the Authentication Token, Position and Application Id cookies that are to be sent during the login process. But the documentation and example code we have is not consistent as to the naming convention of these cookies:

AuthToken or AuthenticationToken or AuthnToken

AuthPosition or Position

applicationId or ApplicationId

Furthermore, we are not getting any of the events: OnOpen, OnError.

Can you indicate where we may be going wrong?

Maybe there is a more recent document than “WebsocketAPI_ProtocolSpecification.pdf” v1.4 of Oct 2020?

Many thanks in advance







websocketsc#error-login
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
17.1k 46 13 19

Hi @tony10,

Can you please try this .NET example and see if it works for you? In your example, you are sending the authentication token along with the connection-upgrade request. Server is expecting a login request message on the websocket instead and maybe why it closes the connection.

Either way, please use one of the samples to understand the workings. Thanks.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
17.4k 34 12 12

Hello @tony10

Besides the example suggested by my colleague, you can find WebSocket Real-Time streaming workflow tutorials from the following resources:

The code example in the tutorial pages are written in Python, but the workflow concept is the same with C# or other languages.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.