I have a dedicated server with a Skype client running on it. I intend to use the Skype COM API to make an AJAX-based live-chat on my website.
However, for this to work, I need an object to be initialized only once for all visitors, and I need to be able to use that very same object across visitors too开发者_高级运维. How can this be done?
maybe you can put it on your application
System.Web.HttpApplication
class and instance it on
Application_Start()
or
Application_Init()
You are looking for a singleton pattern. However you will get global state, it would probably better to share the chat messages using a database of some sort. Global state is tricky to test.
I ended up using the Application["keyhere"] object to simulate singleton properly.
精彩评论