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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

Clean stopping of continuous connectivity to RTO

We are in the process of making changes in order to shut down our connection to the rate feed just prior to our end of day process begins….and then to reconnect hours later in the early morning. The developer has come upon some errors when attempting to reconnect to the feed and I am hoping you can provide some guidance. We are very interested in making sure that we are performing this disconnect/reconnect in as per Refinitiv’s standards. These changes are meant to quiet some of the after-hours connection errors we receive here on a regular basis.

Also say we are reconnecting after a time period. There examples show exiting after disposing of the WebSocket Task. This results in a TaskCanceledException the next time I try to connect. I am currently ignoring this error but would like to know if there is a better way.


e.g. Code to cancel the socket.

Cts.Cancel();

WebSocket.Dispose();

This is the exception I get:

canceled.

--- End of inner exception stack trace ---

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)

at System.Threading.Tasks.Task.Wait()

at BusinessService.RefinitivFeedMgr.SendMessage(String jsonMsg, Boolean logMe) in D:\Users\lauxt\git_branches\ABC_11.0.200.0\Business\BusinessService\Impl\ScheduledTasks\RefinitivFeedMgr.cs:line 794

at BusinessService.RefinitivFeedMgr.SendLogin(Boolean isRefresh) in D:\Users\lauxt\git_branches\ABC_11.0.200.0\Business\BusinessService\Impl\ScheduledTasks\RefinitivFeedMgr.cs:line 778

at BusinessService.RefinitivFeedMgr.Connect() in D:\Users\lauxt\git_branches\ABC_11.0.200.0\Business\BusinessService\Impl\ScheduledTasks\RefinitivFeedMgr.cs:line 678

---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---


Would you be available to assist

#technologywebsockets
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.

Hello @shawn.kelley

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


1 Answer

· Write an Answer
Upvote
Accepted
17.5k 82 39 63

Hi @shawn.kelley

Have you tried checking the 'IsCancellationRequest' or 'CanBeCanceled' properties before executing the Cancel()? The issue seems to be related to the state of your CancellationToken as opposed to being related to RTO.

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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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