UNPKG

kevoree-group-remotews

Version:

A Kevoree group that uses an external remote WebSocket broadcast server to share models.<br/>The attribute <strong>answerPull</strong> specifies whether the fragments must send their model back on pull requests.

22 lines (19 loc) 644 B
/* globals WebSocket */ // This file will be used instead of 'ws' for browsers. // Because browsers already have a WebSocket implementation // this file intent to only extend the prototype to add .on() & .off() WebSocket.prototype.on = function (event, handler) { this['on' + event] = handler; }; WebSocket.prototype.off = function (event, handler) { if (typeof handler === 'function') { if (this['on' + event] === handler) { delete this['on' + event]; } } }; function Server() { throw new Error('WebSocketServer are not supported in browser environment.'); } module.exports = WebSocket; module.exports.Server = Server;