Connecting to the sample EchoService

Mar 1, 2012 at 7:39 AM

From the quickstart solution, I have compiled the sample SuperSocket.QuickStart.EchoService.dll service.

I then copied it into the QuickStart\EchoService\bin\Debug folder and ran the "RunServer.bat" file to launch the service.  I was greeted with the optimistic message:

 

Press any key to start server!
a
The server has been started! Press key 'q' to stop the server.

 

The following is my SuperSocket.SocketService.exe.config contents:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="socketServer" type="SuperSocket.SocketEngine.Configuration.SocketServiceConfig, SuperSocket.SocketEngine"/>
    </configSections>
    <appSettings>
        <add key="ServiceName" value="EchoService"/>
    </appSettings>
    <socketServer loggingMode="IndependantFile">
        <servers>
            <server name="EchoServer"
                 serviceName="EchoService" ip="Any" port="2012" mode="Async" maxConnectionNumber="10000">
            </server>
        </servers>
        <services>
            <service name="EchoService"
                     type="SuperSocket.QuickStart.EchoService.EchoServer, SuperSocket.QuickStart.EchoService" />
        </services>
        <connectionFilters>
        </connectionFilters>
    </socketServer>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>
</configuration>

 

I then created a javascript function so that I could test my service in google chrome:

 

    function RunTest() {
        //var wsUri = "ws://echo.websocket.org/";
        var wsUri = "ws://localhost:2012/EchoServer/";

        var myWebSocket = new WebSocket(wsUri);
        myWebSocket.onmessage = function (evt) {
            console.log("message received: " + evt.data);
        }
        myWebSocket.onopen = function (evt) {
            console.log("connection opened - sending request");
            myWebSocket.send("Testing");
        };
    }

 

 

I have tried the following urls:

ws://localhost:2012/
ws://localhost:2012/EchoService
ws://localhost:2012/EchoService/
ws://localhost:2012/EchoServer
ws://localhost:2012/EchoServer/

But none of them result in a successful test.  What URL should I be using?  Note that the test works fine when I try it agains the echo.websockets.org service (commented out above).

 

 

 

 

 

 

 

Mar 1, 2012 at 7:47 AM

Hi, I think you misunderstood something.

SuperSocket is not a websocket server, it is generic socket server framework.

What you should use is SuperWebSocket:

http://superwebsocket.codeplex.com/

You can get it started by the sample SuperWebSocketWeb project.