How to use the primus.io function in primus

To help you get started, we’ve selected a few primus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github peeriodproject / core / src / core / ui / UiManager.js View on Github external
UiManager.prototype._setupSocketServer = function () {
        this._socketServer = new PrimusIo(this._httpServer, {
            port: this._config.get('ui.UiManager.socketServer.port'),
            transformer: this._config.get('ui.UiManager.socketServer.transformer'),
            parser: this._config.get('ui.UiManager.socketServer.parser')
        });

        var staticPublicPath = this._config.get('ui.UiManager.staticServer.publicPath');
        var clientLibPath = path.resolve(path.join(staticPublicPath, 'primus.io.js'));

        // todo check if file exists
        this._socketServer.save(clientLibPath);

        this._setupSocketChannelComponentMap();
        this._setupSocketChannels();
    };
github logv / superfluous / superfluous / core / server / socket.js View on Github external
setup_io: function(app, server) {
    // Setup Socket.IO
    var io;
    var transformer = config.primus_transformer || "engine.io";
    var primus = new Primus(server, {
      transformer: transformer,
    });
    // add rooms to Primus
    _primus = primus;

    this.install(primus);

    var shutdown = require_core('server/shutdown');
    shutdown.install(primus);

    /**
     * auth callback
     *
     * @event auth
     * @param {app} app the express app to add query parsing middleware to
     */
github peeriodproject / core / src / core / ui / UiManager.ts View on Github external
private _setupSocketServer ():void {
		this._socketServer = new PrimusIo(this._httpServer, {
			port       : this._config.get('ui.UiManager.socketServer.port'),
			transformer: this._config.get('ui.UiManager.socketServer.transformer'),
			parser     : this._config.get('ui.UiManager.socketServer.parser')
		});

		var staticPublicPath:string = this._config.get('ui.UiManager.staticServer.publicPath');
		var clientLibPath:string = path.resolve(path.join(staticPublicPath, 'primus.io.js'));

		// todo check if file exists
		this._socketServer.save(clientLibPath);

		this._setupSocketChannelComponentMap();
		this._setupSocketChannels();
	}

primus

Primus is a simple abstraction around real-time frameworks. It allows you to easily switch between different frameworks without any code changes.

MIT
Latest version published 12 months ago

Package Health Score

70 / 100
Full package analysis