A simple socket problem ... with .Net ?

We’ve all been there: your friend who’s a web programmer can type something this simple …

socket = new io.connect('http://blah.com/',
          {resource: 'blah/socket.io', transports: ['xhr-polling']});
var content = $('#content');

and then …

socket.on('message', function(message){
    content.prepend("<div class='logLine'>" + message + "</div>

");
}) ;

Couldn’t be easier.

i bet it’s just as simple, in Unity, if you know what you’re doing with .Net sockets.

Is there anyone here who knows what they’re doing with .Net sockets?! :slight_smile: Not me!

If it’s just a couple lines of code, it would be great to know how to do this. Thanks!

To be honest, no, i’ve not been there because i’ve never used WebSockets yet :wink: WebSockets are not usual network sockets. They probably use HTTP sockets behind the scenes but they use a completely event driven system.

I guess you need a WebSocket implementation that works in Unity. Here is one :wink: However i did not test this library and i’m not sure if it works in a webbuild (due to socket security restrictions, read the part about sockets).

Feel free to test it and tell us if you had success :wink: