Sha256: 5a2328a059834ffd3e3b68e89ded45f77f4372840caef1cde5b568b860e471a1

Contents?: true

Size: 997 Bytes

Versions: 17

Compression:

Stored size: 997 Bytes

Contents

/**
 * Created by Tony on 11/1/13.
 */
var http = require('http');
var sockjs = require('sockjs');
var Hapi = require('hapi');

// 1. Echo sockjs server
var sockjs_opts = {
    sockjs_url: "http://cdn.jsdelivr.net/sockjs/1.0.1/sockjs.min.js"
};

var sockjs_echo = sockjs.createServer(sockjs_opts);
sockjs_echo.on('connection', function(conn) {
    conn.on('data', function(message) {
        conn.write(message);
    });
});

// Create a server and set port (default host 0.0.0.0)
var hapi_server = new Hapi.Server();
hapi_server.connection({
    port: 9999
});

hapi_server.register(require('inert'), (err) => {
    hapi_server.route({
        method: 'GET',
        path: '/{path*}',
        handler: function(request, reply) {
            reply.file('./html/index.html');
        }
    });
});

//hapi_server.listener is the http listener hapi uses
sockjs_echo.installHandlers(hapi_server.listener, {
    prefix: '/echo'
});

console.log(' [*] Listening on 0.0.0.0:9999');
hapi_server.start();

Version data entries

17 entries across 17 versions & 7 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/sockjs/examples/hapi/server.js
disco_app-0.18.0 test/dummy/node_modules/sockjs/examples/hapi/server.js
disco_app-0.18.2 test/dummy/node_modules/sockjs/examples/hapi/server.js
enju_library-0.3.8 spec/dummy/node_modules/sockjs/examples/hapi/server.js
ilog-0.4.1 node_modules/sockjs/examples/hapi/server.js
ilog-0.4.0 node_modules/sockjs/examples/hapi/server.js
ilog-0.3.3 node_modules/sockjs/examples/hapi/server.js
jester-data-8.0.0 node_modules/sockjs/examples/hapi/server.js
ezii-os-5.2.1 node_modules/sockjs/examples/hapi/server.js
ezii-os-2.0.1 node_modules/sockjs/examples/hapi/server.js
ezii-os-1.1.0 node_modules/sockjs/examples/hapi/server.js
ezii-os-1.0.0 node_modules/sockjs/examples/hapi/server.js
ezii-os-0.0.0.1.0 node_modules/sockjs/examples/hapi/server.js
ezii-os-0.0.0.0.1 node_modules/sockjs/examples/hapi/server.js
optimacms-0.4.3 spec/dummy/node_modules/sockjs/examples/hapi/server.js
optimacms-0.4.2 spec/dummy/node_modules/sockjs/examples/hapi/server.js
dragonfly_puppeteer-0.1.0 node_modules/sockjs/examples/hapi/server.js