Sample SockJS Application server

SockJS Application server

1
2
3
4
5
var mirrorJS = require("../mirrorjs-0.0.1.min");
global.__base_path = __dirname + "/";
mirrorJS.widgets.controller.installAll();
var myAppServer = new mirrorJS.servers.SockJS(
                        mirrorJS.servers.readConf(global.__base_path + "mirror.conf", true) );

mirror.conf

1
2
3
4
5
6
7
8
{
	"host": "0.0.0.0",
	"port": 9999,
	"aliases": {
		"test1": "apps/testApp1.js",
		"test2": "apps/testApp2.js"
	}
}

Sample application (“apps/testApp1.js”)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var mirrorJS = require("../../mirror/mirror");
 
function main(app, args)
{
    var myContainer = app.create("container");
    myContainer.setParent( args["my_cnt"] );
}
 
module.exports = function(connection)
{
    return new mirrorJS.app.server(new mirrorJS.ui.connectors.remote(connection), main, 
        {
            /* CONF */
            "widgets":
                {
                    "prefixID" : "app1_"
                },
 
            "args":
                {
                    /* CUSTOM ARGS */
                    "my_cnt" :  "#myDiv"
                }
        });
};

Simple Chat (Thin Client)

Thin Client - mvvm chat
View it on github

Leave a Reply

Your email address will not be published. Required fields are marked *