API Support Forum
OEC API > API Support > does Reconnect() raise any events?
Author Topic: does Reconnect() raise any events?
(6 messages, Page 1 of 1)
Moderators: VPfau
TLau471
Posts: 70
Joined:


Posted: May 30, 2016 @ 12:09 PM             Msg. 1 of 6
After calling Reconnect(),

1. What are the expected events? OnLoginComplete is not raised
2. Do we need to resubscribe to symbols?

Thanks.
TLau
NShine
Posts: 36
Joined:


Posted: May 31, 2016 @ 09:00 AM             Msg. 2 of 6
What are the expected events? OnLoginComplete is not raised
I've just tested this, and OnLoginComplete is raised.

Do we need to resubscribe to symbols?
Yes
TLau471
Posts: 70
Joined:


Posted: May 31, 2016 @ 09:52 PM             Msg. 3 of 6
Still not happening for me.

1. I connect using Connect(hostname, 9200, Me.Username, Me.Password, True)
2. I simulate disconnection by calling Disconnect()
3. This raises OnDisconnected event
4. I call Reconnect() inside the OnDisconnected event, but nothing happens

Did I miss any step?
TLau

Edited by TLau471 on May 31, 2016 09:53 PM
NShine
Posts: 36
Joined:


Posted: Jun 01, 2016 @ 07:09 AM             Msg. 4 of 6
Reconnect can only be called if you are already connected. If you lose connection (or call Disconnect), please use Connect to login.
TLau471
Posts: 70
Joined:


Posted: Jun 01, 2016 @ 07:12 AM             Msg. 5 of 6
ok...... under what circumstances should we call Reconnect?
Rather, what purpose does Reconnect serve?
TLau
NShine
Posts: 36
Joined:


Posted: Jun 01, 2016 @ 07:31 AM             Msg. 6 of 6
Reconnect disconnects the client, resets the session information, and runs the connection code. This will clear all client data and reload only the data given during initialization. You could accomplish the same thing by calling Disconnect, waiting, and then calling Connect.