Joined January 2013

Sorin Baba

Web Developer

Posted to and OpenShift Websockets over 1 year ago

@camillo777 yes, you should use ws://

Posted to and OpenShift Websockets over 1 year ago

@camillo777 yes. So, for plain WebSockets ws:// you will use port 8000 and for secured connections wss:// port 8443. Here’s an example: <= your current HTTP URL <= WebSockets enables HTTP URL <= your current HTTPs URL <= WebSockets enables HTTPs URL

You can find more details here:

Posted to and OpenShift Websockets over 1 year ago

On the server side you should use the default port provided by openshift:

self.port      = process.env.OPENSHIFT_INTERNAL_PORT || process.env.OPENSHIFT_NODEJS_PORT || 8080;

In this way I initialized the on the server side:

// initialization on the server side
self.initializeSocketIO = function() {
        self.server = require('http').createServer(; = require('').listen(self.server);'browser client minification');  // send minified client'browser client etag');          // apply etag caching logic based on version number'browser client gzip');          // gzip the file'log level', 1);                    // reduce logging'transports', [
        return this;

    self.addSocketIOEvents = function() {'connection', function (socket) {
          socket.emit('news', { hello: 'world' });
          socket.on('my other event', function (data) {

 *  Initializes the sample application.
self.initialize = function() {

    // Create the express server and routes.

On the client side I used it in this way (index.html):

<!doctype html>
<html lang="en">
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<script src="/"></script>
  var socket = io.connect('ws://');
  socket.on('news', function (data) {
    socket.emit('my other event', { my: 'data' });

It should work fine for you. You used a bad port number.

227 Karma
15,015 Total ProTip Views