How to close socket manually

hi,I write a replay test model in my program for test some strategy,so I will run up and shut down my program frequently,and I found some times can not connect replay or marker socket,I think there where be need close socket manually,so I can reconnect socket normally.
but I can not find any api about close socket manually, so how can I close the socket manually ,or there has other cases?

I doubt that the socket is being left open, it’s more likely you’re encountering a rate limit. Check out this section of the API FAQ to learn about rate limits.

I fix the time out bug with change a websocket lib( now I use OKHTTP in java)
but I find another problem:
1:I can run and stop Replay model,with connect the replay socket and Market socket mormally,
and sub the quote, but the quote time is not the replay clock time ,it is the current real time quote.

2: and I stop the replay program,start demo model,I can not connect marker socket (md.tradovateapi.com), I receive a close paload: code:1000 reason:Bye
but can connect trade socket(demo.tradovateapi.com), and receive the hear beat.

I fix the problem 2,because I to eartly to send sub request

1 Like

fix problem 1 ,because I use the md.tradovateapi.com ,this is the live market host
change to replay.tradovateapi.com the time is match to replay start time

1 Like