0

Excel AddIn using Add-In express, VS2010, cometd.net talks to cometd server and Tom cat In RTDInitialize event handler, I log in Tom Cat and connect to cometd server, I use an instance of class credential to remember it is loggedOn(set IsLoggedOn to true) and sessionID.

In RefreshData handler of topic, I will register to cometd server if not register yet. Then I will subscribe topic to Tom Cat. Now when users delete the RTD function from Excel, DisconnectData handler is called, in it I disconnect from cometd server, logout from Tom Cat, clear out sessionID. Next time, when users enter RTD function again, it will call RTDInitialize event handler, login and connect where IsLoggoned set to true and sessionID is updated. The strange thing is after 2nd time login, in refreshData, I check the credentials, IsLogged becomes false and sessionID is empty just like what it was at first logout. Anyone know why? not sure if I make it clear. Thanks

toosensitive
  • 2,335
  • 7
  • 46
  • 88

1 Answers1

1

I suppose you have just one topic in your tests. I suppose that you store a reference to the "instance of class credential" on the class level of the RTD server module. And when you delete the topic, the RTD server module is destroyed; this kills the information about previous connection. If you think that I misunderstood the problem, please clarify.

  • thanks @Andrei. I have only one instance of topic in RTD server module and one instance of credential in the module. To simplify, I began to test with one topic, the same issue happened if I tested with multiple RTD functions. (I mean MyRTD(paraA), MyRTD(paraB). Do you mean that instance of credentials should not be in server module. Then where should I put it? I get new instance of credential every time RTD server module is initialzed. thanks – toosensitive Feb 27 '12 at 15:27
  • I moved the instance of class credentials to another class from RTD server module and then it works! Thanks, Andrei. – toosensitive Feb 27 '12 at 23:32