embed supersocket within existing webservice

Nov 7, 2012 at 2:41 AM

Currently, I've got some windows app clients (c# winform) polling a asp.net webservice. I've been looking at replacing the polling with supersockets but can't get my head around how to merge supersocket.socketservice with my webservice.

i've looked through the examples on creating the echo and broadcast servers but they are all standalone services which create their own sessions for each connection. how would i merge this session with a webservice session.

Coordinator
Nov 7, 2012 at 2:48 AM

How did you host your webservice? In Website?

You also can host your SuperSocket instances in Website.

For SuperSocket 1.4, please read the last part of this article:

http://supersocket.codeplex.com/wikipage?title=let%20your%20appserver%20run

For SuperSocket 1.5, please follow this startup code:

http://supersocket.codeplex.com/SourceControl/changeset/view/a06bcc1e8f21#QuickStart%2fBasic%2fTelnetServer_StartByConfig%2fProgram.cs

Coordinator
Nov 7, 2012 at 2:51 AM

But I don't suggest you run SuperSocket in website, because IIS don't consider the raw socket requests as http requests, if there is no http requests for a while, the website's application pool will be recycled, then the socket server will be shutdown. You need to do more works to keep the application pool alive.

Nov 7, 2012 at 3:05 AM

wow, quick reply!

not sure what you mean by hosting the webservice through a website. we just have a independent asmx webservice that our windows c# clients hit and what i want to do is to create a supersocket when our client first hit the webservice and keep that socket alive as long as they need it, hours/days

from the 1.4 doco last section titled: You also can run SuperSocket in your own application container what i get from that is that i should create a singleton object on my webservice for an instance of SocketServiceManager? and somehow call my webservice functions from the socketservice sessions?

 

Coordinator
Nov 7, 2012 at 3:07 AM

NO, what you should do is add the startup code in your standalone server application's entrance.

Nov 7, 2012 at 3:17 AM

hum... confused. my webservice IS my 'server' and it's stateless so there is no Program.cs or main function that I add it to. hence why I'm thinking i need to add a singleton SocketServiceManager because that's essentially adding it to the entrance of my server. my webservice is created in IIS, was this what you mean by hosting the webservice in a website as your first reply?

Or do you mean to say, I should create a standalone service that's separate from my asmx webservice for socket connections?

Coordinator
Nov 7, 2012 at 3:23 AM

Do you want to replace webservice with raw socket communication?

If so your webservice is not required any more, you can use SuperSocket.SocketService.exe directly.

 

I have a question:

Why don't you choose WCF over TCP binding, it also provides the duplex commutation feature.

 

SuperSocket is designed for the applications who cares about the network protocols.

 

 

Nov 7, 2012 at 4:58 AM

thanks for pointing me in the right direction, i'm looking into wcf 4.5 websockets now :)