Running the chat sample in Mono

Dec 3, 2011 at 11:19 AM


Not sure if this has been asked before or if I am missing something obvious but I'm having a hard time getting the SuperWebSocketWeb sample to run in Mono. I tested it in OSX with Mono 2.10.6 and Ubuntu with Mono 2.10.5. I was able to compile the solution in both environments from MonoDevelop but starting the app gave me this error in both cases:

Adding applications '/:.'...
Registering application:
    Host:          any
    Port:          any
    Virtual path:  /
    Physical path: /home/foo/development/workspaces/superwebsockets/Samples/SuperWebSocketWeb/
Listening on address:
Root directory: /home/foo/development/workspaces/superwebsockets/Samples/SuperWebSocketWeb
Listening on port: 8080 (non-secure)
Handling exception type NotImplementedException
Message is The requested feature is not implemented.
IsTerminating is set to True
System.NotImplementedException: The requested feature is not implemented.
  at System.Net.Sockets.Socket.IOControl (IOControlCode ioControlCode, System.Byte[] optionInValue, System.Byte[] optionOutValue) [0x00000] in <filename unknown>:0
  at SuperSocket.SocketEngine.TcpSocketServerBase`2[SuperSocket.SocketEngine.AsyncSocketSession`2[SuperWebSocket.WebSocketSession,SuperWebSocket.WebSocketCommandInfo],SuperWebSocket.WebSocketSession].RegisterSession (System.Net.Sockets.Socket client, SuperSocket.SocketEngine.AsyncSocketSession`2 session) [0x00000] in <filename unknown>:0
  at SuperSocket.SocketEngine.AsyncSocketServer`2[SuperWebSocket.WebSocketSession,SuperWebSocket.WebSocketCommandInfo].AceptNewClient (System.Net.Sockets.SocketAsyncEventArgs e) [0x00000] in <filename unknown>:0
  at SuperSocket.SocketEngine.AsyncSocketServer`2[SuperWebSocket.WebSocketSession,SuperWebSocket.WebSocketCommandInfo].acceptEventArg_Completed (System.Object sender, System.Net.Sockets.SocketAsyncEventArgs e) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted (System.Net.Sockets.SocketAsyncEventArgs e) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.SocketAsyncEventArgs.AcceptCallback (IAsyncResult ares) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.SocketAsyncEventArgs.DispatcherCB (IAsyncResult ares) [0x00000] in <filename unknown>:0

Has anyone got a pointer for me?



Dec 3, 2011 at 2:11 PM

You cannot use SuperSocket's binaries of .NET in Mono.

Dec 3, 2011 at 2:38 PM
Edited Dec 3, 2011 at 2:39 PM

I have checked in the changes for Mono support just now.

Could you download the latest source code and then use SuperWebSocket.Mono.sln to build your SuperWebSocket assembly?

I am looking forward your feedback about SuperWebSocket on Mono.

Dec 4, 2011 at 7:29 AM

Thanks for providing the Mono artefacts for the SuperWebsocket project! I was able to build both SuperSocket and SuperWebsocket from master (after a small change to a loggin message in SuperWebSocket/WebSocketServer.cs).

Starting the SuperWebsocketWeb project works now without trouble. However, I am a little unclear which of the sample projects is supposed to provide the server side for this sample application. Is there any documentation on how to run the SuperWebsocketWeb example so it works? At the moment the LiveChat.aspx client simply shows '* connecting to server' before timing out since there is no server running for the /sample endpoint.

Dec 5, 2011 at 3:11 AM

The websocket server instance run in web application, started by code in Global.asax.cs.

You'd better take a look at that file.

Dec 5, 2011 at 3:32 AM

Thanks for pointing this out.

You may have figured out I am not very familiar with .Net. I am coming from a Java background and have used Netty recently for websocket related apps. I have also worked Ruby and node.js to achieve this.

Unfortunately I have not been able to get your app running thus far. The SuperWebSocketWeb app starts, prompts for a login, then in the live chat application I can see these messages:

* Connecting to server ..
* Connection closed
* Secure Connection closed

The connection is being closed after a timeout. I presume these problems are related to the mono deployment but that is all I can use for now as I don't currently have a Windows virtual machine to test this with. 

Any pointers are appreciated.

Btw, have you considered supporting automatic fall-back mechanisms similar to and sock.js for SuperWebSocket?

Dec 5, 2011 at 3:48 AM

Did you check the logging files which locate in /Logs directory?

At the same time, you need to confirm correct log4net.config file is in used.

Use the one below please:

Dec 5, 2011 at 4:43 AM

I pasted the log config file into SuperWebSocketWeb/Config/log4net.config and restarted the app. However, I am unable to see the Logs directory. I even added a console appender:

.28125 <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">

<filter type="log4net.Filter.LevelMatchFilter">

             <levelToMatch value="DEBUG" />


    <layout type="log4net.Layout.PatternLayout">

        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />




No luck.


Dec 5, 2011 at 4:51 AM

Which webserver are you using?

Dec 5, 2011 at 5:08 AM

xsp4 is used by default on both Mac and Linux.

Dec 5, 2011 at 1:39 PM

Hello, I have fixed one bug of Mono in Linux and the code has been checked in.

Could you get the latest code by svn and then verify it again? I have run my sample successfully in Linux (please ignore secure websocket connection).

Dec 5, 2011 at 1:51 PM

BTW, the logging works for me.

Dec 5, 2011 at 9:15 PM

Hi Kerry,

Thank you so much for looking into this! I just got the application to run on Linux (no luck yet on Mac but I'll take another look later on). This is quite exciting indeed!