{"_id":"apostrophe-websockets","_rev":"34-6ad63666213b2d3f6210ae3503166058","name":"apostrophe-websockets","dist-tags":{"latest":"0.5.6"},"versions":{"0.5.0":{"name":"apostrophe-websockets","version":"0.5.0","keywords":["socketio","apostrophe","websockets","realtime"],"author":{"name":"P'unk Avenue"},"license":"BSD","_id":"apostrophe-websockets@0.5.0","maintainers":[{"name":"kylestetz","email":"kylestetz@gmail.com"}],"homepage":"https://github.com/punkave/apostrophe-websockets","bugs":{"url":"https://github.com/punkave/apostrophe-websockets/issues"},"dist":{"shasum":"aa39f2b69f6d0e487afd47baf1cdc252c424e284","tarball":"https://registry.npmjs.org/apostrophe-websockets/-/apostrophe-websockets-0.5.0.tgz","integrity":"sha512-CHoADWKvMJFC1/XK1VkCCnVndbOZ2u2vF91qe5BAAEuevbI6GERPj07ECN2aANXgpasntFnbGwvs3k/AugJRRw==","signatures":[{"sig":"MEYCIQDCbfJhJQC0N1g3DBy1AhG1wzPVOnfYkgZdOL2NOKy81wIhAJIdYaBV9L9UzI44xKwMWtgaVEx5qFH+cAp4vibmtyJL","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":"./","_shasum":"aa39f2b69f6d0e487afd47baf1cdc252c424e284","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"kylestetz","email":"kylestetz@gmail.com"},"repository":{"url":"https://github.com/punkave/apostrophe-websockets","type":"git"},"_npmVersion":"1.4.9","description":"Enables socket.io in Apostrophe projects.","directories":{},"dependencies":{"lodash":"2.4.1","socket.io":"1.0.6"}},"0.5.1":{"name":"apostrophe-websockets","version":"0.5.1","keywords":["socketio","apostrophe","websockets","realtime"],"author":{"name":"P'unk Avenue"},"license":"BSD","_id":"apostrophe-websockets@0.5.1","maintainers":[{"name":"kylestetz","email":"kylestetz@gmail.com"}],"homepage":"https://github.com/punkave/apostrophe-websockets","bugs":{"url":"https://github.com/punkave/apostrophe-websockets/issues"},"dist":{"shasum":"c90f110fd7981d1ea5847f263f545455389a3990","tarball":"https://registry.npmjs.org/apostrophe-websockets/-/apostrophe-websockets-0.5.1.tgz","integrity":"sha512-Ro/hfX1uW9uZISO2dCVBUpq1ZQC3bVDNdItLe8qI2Yyg/yjV1godcd0WYLdE0B4Jelsksm5zLgximCLQO+f4kQ==","signatures":[{"sig":"MEUCIHK1gLtCXDXwxdJPlEwIwqtOXpsiXklEcM5mdjF7VfoNAiEAkV7eAGRBztV1gMkPlBYBQygVCyn6phTNPsJQ0pRs3rs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"c90f110fd7981d1ea5847f263f545455389a3990","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"kylestetz","email":"kylestetz@gmail.com"},"repository":{"url":"https://github.com/punkave/apostrophe-websockets","type":"git"},"_npmVersion":"1.4.9","description":"Enables socket.io in Apostrophe projects.","directories":{},"dependencies":{"lodash":"2.4.1","socket.io":"1.0.6"}},"0.5.2":{"name":"apostrophe-websockets","version":"0.5.2","keywords":["socketio","apostrophe","websockets","realtime"],"author":{"name":"P'unk Avenue"},"license":"BSD","_id":"apostrophe-websockets@0.5.2","maintainers":[{"name":"kylestetz","email":"kylestetz@gmail.com"}],"homepage":"https://github.com/punkave/apostrophe-websockets","bugs":{"url":"https://github.com/punkave/apostrophe-websockets/issues"},"dist":{"shasum":"70d74feddf5023d95d925afdd6f1b4802627f95d","tarball":"https://registry.npmjs.org/apostrophe-websockets/-/apostrophe-websockets-0.5.2.tgz","integrity":"sha512-FtOGG8GLERFt8Y955vCWSoDOLQWPrxkmLHWOjCZSr4pabBDPn81577sJnXUhesySA1JzO5XlePWqmPoP/kXiDg==","signatures":[{"sig":"MEUCIFDbnXOxeB49kzOhn9bnQz0ZbyktPm2bm4rogku8eJ4KAiEAr0VGFKze4umlKhVZ7HiWJ4kNISTYsT64oPT+FU5tZ8s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"70d74feddf5023d95d925afdd6f1b4802627f95d","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"kylestetz","email":"kylestetz@gmail.com"},"repository":{"url":"https://github.com/punkave/apostrophe-websockets","type":"git"},"_npmVersion":"1.4.9","description":"Enables socket.io in Apostrophe projects.","directories":{},"dependencies":{"lodash":"2.4.1","socket.io":"1.0.6"}},"0.5.3":{"name":"apostrophe-websockets","version":"0.5.3","keywords":["socketio","apostrophe","websockets","realtime"],"author":{"name":"P'unk Avenue"},"license":"BSD","_id":"apostrophe-websockets@0.5.3","maintainers":[{"name":"kylestetz","email":"kylestetz@gmail.com"}],"homepage":"https://github.com/punkave/apostrophe-websockets","bugs":{"url":"https://github.com/punkave/apostrophe-websockets/issues"},"dist":{"shasum":"6c15cf22d118d9842ee3dd313e26ecb97c470d37","tarball":"https://registry.npmjs.org/apostrophe-websockets/-/apostrophe-websockets-0.5.3.tgz","integrity":"sha512-MqtK7oFDHkDa2yaArO1t1zctjt6ssvnkERpJXMSEEOM9nBHeUMLqUqSDw+NxWcO+XuyPibuo5gK6dDWX2ehYJg==","signatures":[{"sig":"MEYCIQD2BpZODxzQbHq8VDNiMCJgdATUN9+miJARp0hEtMmpbQIhAONhtJQ6xV8HTlzi02AS/alLTtB2AW9izbgd2uXbmo3S","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"6c15cf22d118d9842ee3dd313e26ecb97c470d37","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"kylestetz","email":"kylestetz@gmail.com"},"repository":{"url":"https://github.com/punkave/apostrophe-websockets","type":"git"},"_npmVersion":"1.4.9","description":"Enables socket.io in Apostrophe projects.","directories":{},"dependencies":{"lodash":"2.4.1","socket.io":"1.0.6"}},"0.5.4":{"name":"apostrophe-websockets","version":"0.5.4","keywords":["socketio","apostrophe","websockets","realtime"],"author":{"name":"P'unk Avenue"},"license":"BSD","_id":"apostrophe-websockets@0.5.4","maintainers":[{"name":"kylestetz","email":"kylestetz@gmail.com"}],"homepage":"https://github.com/punkave/apostrophe-websockets","bugs":{"url":"https://github.com/punkave/apostrophe-websockets/issues"},"dist":{"shasum":"daa3860a5e5b0fd8a067f92b7daabb926f9cfb33","tarball":"https://registry.npmjs.org/apostrophe-websockets/-/apostrophe-websockets-0.5.4.tgz","integrity":"sha512-+gOwaEvzvWZMcCfk5r6ZNbcQGaoDny2rpDdh+02WJTMIinOGVtmlBcwFKObWKN0TlLn97OE2MY0PC15I/I5eVg==","signatures":[{"sig":"MEUCIDVP9jt8LpRb7mRbKYzMqkY7ZCJRVhcBxel9+ltGfCqXAiEAxc7CMEWpDORmquDF+YYsTzUXj269I7BvoTOzp8UcR9Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"daa3860a5e5b0fd8a067f92b7daabb926f9cfb33","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"kylestetz","email":"kylestetz@gmail.com"},"repository":{"url":"https://github.com/punkave/apostrophe-websockets","type":"git"},"_npmVersion":"1.4.9","description":"Enables socket.io in Apostrophe projects.","directories":{},"dependencies":{"lodash":"2.4.1","socket.io":"1.0.6"}},"0.5.5":{"name":"apostrophe-websockets","version":"0.5.5","keywords":["socketio","apostrophe","websockets","realtime"],"author":{"name":"P'unk Avenue"},"license":"BSD","_id":"apostrophe-websockets@0.5.5","maintainers":[{"name":"kylestetz","email":"kylestetz@gmail.com"}],"homepage":"https://github.com/punkave/apostrophe-websockets","bugs":{"url":"https://github.com/punkave/apostrophe-websockets/issues"},"dist":{"shasum":"e9abc68e3bb073d2169da7954655bcbba195b011","tarball":"https://registry.npmjs.org/apostrophe-websockets/-/apostrophe-websockets-0.5.5.tgz","integrity":"sha512-XtkZ50fI4/SOdvTbc2kcVBeHBXCfG/cGqkjWZNBhWuGTCxEI77CYrI3PN+Zzq7kS6WlodfXVw3Yh+FmBuX8v3w==","signatures":[{"sig":"MEUCIQDFKgvL1ZhR3Nm6CR/VlQFaGwFuYUS74HB7aBe6Zn5jHQIgd76Z0D6vUobhoj4MeskZ7bnVyyI2TtEziAlQsPv0HDM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"e9abc68e3bb073d2169da7954655bcbba195b011","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"kylestetz","email":"kylestetz@gmail.com"},"repository":{"url":"https://github.com/punkave/apostrophe-websockets","type":"git"},"_npmVersion":"1.4.9","description":"Enables socket.io in Apostrophe projects.","directories":{},"dependencies":{"lodash":"2.4.1","socket.io":"1.0.6"}},"0.5.6":{"name":"apostrophe-websockets","version":"0.5.6","keywords":["socketio","apostrophe","websockets","realtime"],"author":{"name":"P'unk Avenue"},"license":"BSD","_id":"apostrophe-websockets@0.5.6","maintainers":[{"name":"boutell","email":"tom@punkave.com"},{"name":"kylestetz","email":"kylestetz@gmail.com"}],"homepage":"https://github.com/punkave/apostrophe-websockets","bugs":{"url":"https://github.com/punkave/apostrophe-websockets/issues"},"dist":{"shasum":"954ac50da5fe7c8822bfc9d68fc46227aebab2b5","tarball":"https://registry.npmjs.org/apostrophe-websockets/-/apostrophe-websockets-0.5.6.tgz","fileCount":5,"integrity":"sha512-eKSWtgM+0q85rxdDyfXU20fytqzhTnGkDjj/S6EeyLzKra7fi89EHOO4mrZZQwWOV2vufebJDpcAoq5Ge95Upw==","signatures":[{"sig":"MEQCIH7yKhSDhXazjBtcSaMmOkQQE25AZ8H4oiKDND8EMsFCAiAS9EyPvVTAus8ENLJU76lBPaTtDu55h1tuMXqiYCkJyQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5919},"main":"index.js","gitHead":"7c4e1b105f93d89bd9eb12953a35516650d89079","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"boutell","email":"tom@punkave.com"},"repository":{"url":"git+https://github.com/punkave/apostrophe-websockets.git","type":"git"},"_npmVersion":"5.7.1","description":"Enables socket.io in Apostrophe projects.","directories":{},"_nodeVersion":"8.10.0","dependencies":{"lodash":"2.4.1","socket.io":"1.0.6"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/apostrophe-websockets_0.5.6_1523280519205_0.5419382692095658","host":"s3://npm-registry-packages"}}},"time":{"created":"2014-08-02T21:51:26.048Z","modified":"2026-01-26T19:10:06.391Z","0.5.0":"2014-08-02T21:51:26.048Z","0.5.1":"2014-08-02T21:55:46.765Z","0.5.2":"2014-08-02T21:56:55.223Z","0.5.3":"2014-08-02T22:17:33.272Z","0.5.4":"2014-08-02T22:38:50.320Z","0.5.5":"2014-08-02T22:44:45.938Z","0.5.6":"2018-04-09T13:28:39.400Z"},"bugs":{"url":"https://github.com/punkave/apostrophe-websockets/issues"},"author":{"name":"P'unk Avenue"},"license":"BSD","homepage":"https://github.com/punkave/apostrophe-websockets","keywords":["socketio","apostrophe","websockets","realtime"],"repository":{"url":"git+https://github.com/punkave/apostrophe-websockets.git","type":"git"},"description":"Enables socket.io in Apostrophe projects.","maintainers":[{"email":"alex@apostrophecms.com","name":"alexgilbert"},{"email":"tom@apostrophecms.com","name":"boutell"},{"email":"stuart+npm@apostrophecms.com","name":"romanek"},{"email":"robert.means1969+apostrophecms@gmail.com","name":"bodonkey"},{"email":"kylestetz@gmail.com","name":"kylestetz"}],"readme":"Apostrophe Websockets\n=====================\n\n## Currently for OLD versions of Apostrophe\n\nThis module was for Apostrophe 0.5.x. Currently there is no port for Apostrophe 2.x. Contributions welcome.\n\n## How to use\n\n`apostrophe-websockets` adds `socket.io` to your [Apostrophe](https://github.com/punkave/apostrophe) project. To use it, add it to your `package.json` file and then add the following to your Apostrophe `app.js` module configuration:\n\n```javascript\n  ...\n  modules: {\n    'apostrophe-websockets': {\n      adminOnly: false\n    }\n  }\n  ...\n```\n\nCurrently the only option you can pass is `adminOnly`, which when `true` establishes a browser-side socket client only to logged in users. It is `false` by default.\n\nThis will add socket.io to your server and load `socket.io.js` on the frontend. To take advantage of socket connections you'll need to subclass the websockets module on the server.\n\nSubclassing on the Server\n===\n\nCreate a `lib/modules/apostrophe-websockets` folder and add an `index.js` file. Here's the code to get started:\n\n```javascript\n// /lib/modules/apostrophe-websockets/index.js\nmodule.exports = websockets;\n\nfunction websockets(options, callback) {\n  return new websockets.Construct(options, callback);\n}\n\nwebsockets.Construct = function(options, callback) {\n  var self = this;\n\n  module.exports.Super.call(this, options, null);\n\n  self.initializeSockets = function(io) {\n    io.on('connection', function(socket) {\n      // your socket code here\n    });\n  };\n\n  // Must wait at least until next tick to invoke callback!\n  if (callback) {\n    process.nextTick(function() { return callback(null); });\n  }\n\n};\n```\n\nIf you plan to subclass the websockets module more than once, use the `superFunction` pattern to add more code to the existing `initializeSockets` function:\n\n```javascript\nvar superInitializeSockets = self.initializeSockets;\nself.initializeSockets = function(io) {\n  superInitializeSockets(io);\n  // your socket code here\n}\n```\n\nSockets in the Browser\n===\n\nOnce the `apostrophe-sockets` module is added to your project you will have `apos.socket` available on the frontend, which is your socket client. Use this as you would use the `socket` property normally.\n\n```javascript\n// site.js\n\napos.socket.emit('hey', { message: 'I have websockets now.' });\n\napos.socket.on('hello', function(data) {\n  console.log(data);\n});\n```","readmeFilename":"README.md"}