Using secure websocket connection

Post your help queries and engine programming questions here

Using secure websocket connection

Postby bodhran » Thu Jun 26, 2014 11:41 am

Hi all!

some weeks ago I made a post about our problem with firewalls:
viewtopic.php?f=5&t=241&p=1009&hilit=firewall#p1002

I managed to do some routing as Rob suggested, but the problem still remains.

Later I discovered that our connection problem with schools may be caused by a proxy (not a firewall).
I made some tests, from a school computer, to try websocket connection (http://www.websocket.org/echo.html) and I discovered that the connection WORKS only if I enable secure websocket connection (TLS).

So my question is: is there a way to enable the secure connection using net.io?

Thank you in advance
bodhran
 
Posts: 19
Joined: Mon Dec 02, 2013 2:01 pm
Location: Italy

Re: Using secure websocket connection

Postby Smoozilla » Mon Aug 04, 2014 4:51 pm

Yes

ige/server/node_modules/net.io-server/index.js (after npm install!!)

look for:
classId: 'NetIo.Server'

Here's a snippet of all I remember changing. (changed require('http') to require('https') and added the certificates.)
Code: Select all
init: function (port, callback) {
      this._idCounter = 0;

      this._websocket = require('websocket');
      this._http = require('https');

      this._sockets = [];
      this._socketsById = {};

      if (port !== undefined) {
         this.start(port, callback);
      }
   },

   start: function (port, callback) {
      var self = this
      this._port = port;
      var fs = require('fs');
      var options = {
         key: fs.readFileSync('/etc/ssl/virtual/private/yourcert.key'),
         cert: fs.readFileSync('/etc/ssl/virtual/certs/yourcert.crt')
      };
      this._httpServer = this._http.createServer(options,function(request, response) {
         response.writeHead(404);
         response.end();
      });


But I know it's very possible. If this doesn't work let me know I may be leaving something out

-Kade
User avatar
Smoozilla
 
Posts: 10
Joined: Wed Jul 30, 2014 6:37 am

Re: Using secure websocket connection

Postby robaldred » Mon Aug 04, 2014 5:57 pm

Hey

There's another thread in which I proposed exactly the same solution as Kade.
Infact I think you were the op bodhran, you said you were going to check it out later I guess you didn't have chance?

Check it out:
viewtopic.php?f=5&t=271#1118
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: Using secure websocket connection

Postby bodhran » Tue Aug 05, 2014 10:26 am

hi guys!

I installed the net.io-server node module, but now I have to solve the problem of certificates, im trying to find a temporary free certificate just to test the whole thing...
Also, I have to wait the schools to open again in september, to test the connection in the "real world" :)

I will let you know, thank you for your support!
bodhran
 
Posts: 19
Joined: Mon Dec 02, 2013 2:01 pm
Location: Italy

Re: Using secure websocket connection

Postby robaldred » Tue Aug 05, 2014 10:40 am

Just generate a self sign
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: Using secure websocket connection

Postby bodhran » Tue Aug 05, 2014 12:52 pm

ok, I did a test with a self signed certificate... but nothing. :(

I still get the error "Error with connection: Cannot establish connection..."

I also replaced in the net.io-client ws:// with wss://:
url = url.replace('http://', 'wss://');

I tried to connect on ports 443 and 2000.
Rarely happens to me... but im almost giving up at this point :-|
bodhran
 
Posts: 19
Joined: Mon Dec 02, 2013 2:01 pm
Location: Italy

Re: Using secure websocket connection

Postby robaldred » Wed Aug 06, 2014 10:01 am

Can you setup any websocket connection?
Try a connection in isolation without the isogenic engine, it will help debugging because theres so much stuff going on.

have a look at this:
http://einaros.github.io/ws/

Setup a simple websocket test and see what happens.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England


Return to Help & Questions

Who is online

Users browsing this forum: No registered users and 1 guest
cron