{"_id":"transmit","_rev":"81-4c1e2d8123a306e8fe0d56451ece224a","name":"transmit","description":"Simple and fast websocket abstractions for server & client","dist-tags":{"latest":"0.8.3"},"versions":{"0.1.4":{"name":"transmit","version":"0.1.4","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.5.8","ws":"0.4.16"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.1.4","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"465d29636e4795e00cb0067ffef145dd4a3912c6","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.1.4.tgz","integrity":"sha512-w7KyUvxZdR4Sf0id0qDqaHypa9m5MD7O/8fbDaxTmEiMLBPCRbDiTxtfpQ1rXVYHfs3aOsfg43mqlkorFg346Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUCJajgAWTkmAoxGWsJUDNE0NRh1pM4/ZmnsUjPSyCwgIgHuwcOdjMT4mrg00pI9jKGvAuzZqv5hkYrHQFkwDcdlY="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.2.0":{"name":"transmit","version":"0.2.0","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.5.8","ws":"0.4.16"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.2.0","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"93888ce98915c8480b970a5855fd1d48845d3fdf","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.2.0.tgz","integrity":"sha512-WEewN0EmzdjyI+WvVn1e6sT9S9imdYGqI+MnpzC8ZA2hEehy7I1tUkSxCMQIvDGo1QwBdGmlZbMrBTCWz5GGgg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnqkyioUU7vxFi6E0enz0GgvytAUsSsWjxt7Xu4idyqAIgW4hPFANcLs/qNQFsax4BP6BwzwGl0GZMRFUunjEftm4="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.2.2":{"name":"transmit","version":"0.2.2","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.5.8","ws":"0.4.16"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.2.2","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"79d204ee89370e6bb4a3c02f88bd675e036ba3b2","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.2.2.tgz","integrity":"sha512-ssiwdvENZHe5k3TW69+y6U24cEvCcu+I3VVyN/6MA7a0tkNf27RkH4ft6m7rVsplg1KYvWsky7kamzlu0OvL7g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDg30hy9RgzkySe5kYagb0B8mWCsTRzuMx1SKR7ybOVywIgUwAzh5GT3Bf/ExqecqLdDE+EWc8GHcHeNHUYXtEsRPE="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.2.4":{"name":"transmit","version":"0.2.4","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.0","ws":"0.4.16"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.2.4","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"c9dc00ab6aafc5790c5e6339b381ea4ebc0a7864","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.2.4.tgz","integrity":"sha512-lYVRJCiWFPjJ6Fuf+uR5n/zieNcuHjwKgnvPx6hY9gveQyYrRVy5kSRQe13x/FdyRxE12PsrWYlFB4E7oH8saw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFfr+MIxsoM8arpmA60CGUg+3EUDEyn0JR/fmDRRk5yWAiBff7ZmPIzqvYMSunt1GY/E+I2fNM6fH3xg3msM8oTiAQ=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.2.5":{"name":"transmit","version":"0.2.5","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.0","ws":"0.4.16"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.2.5","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"b9ac7a12c5a3a958184d171b952ed869d71a313c","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.2.5.tgz","integrity":"sha512-JW1GNAHtpl/8PllSfVVwXP+h9Osxnf5nYshdnh9ThlvXYMD5F+GtHaDneAJ0b1Zke/49LJj3uTj6ZYSDNFa2HQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICc681pdpWYDPXzs/3LJZ49sLdSTvnxfQN2sAdjw+iK/AiB77oXGI+VTfF2YeZwuWZiZf8QdtiKSW+0jxvUPnaaaPA=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.3.0":{"name":"transmit","version":"0.3.0","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.0","ws":"0.4.16"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.3.0","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"36a7c9ddb7964bb8b8131fe0ab9d35664d7c52b4","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.3.0.tgz","integrity":"sha512-dHYTm0TG1WkKIjWIXKBxN2VQRa9rN5pP07vvGY4XVNmoR7y7DMRQirlzLuDPiX0+oHeYsGVHceHaR1ZpQXmbPA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDiQs31acf3yqT3u5FF8CopX+Q+ZqSnIzcRANhMt9GlZwIgG3PxGf2juvvnR1LjmCBsNsZovf068Iv4Lop20UrkQ00="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.3.2":{"name":"transmit","version":"0.3.2","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.0","ws":"0.4.16"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.3.2","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"a7e81fc9f09f8f0ab4c9ec91e25cc6ed8cb7ad50","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.3.2.tgz","integrity":"sha512-hBXJzoOHYVZedClQkSkq2pFx49UVUmInzcjsT/a7JhYKy3+60wZakiQPOFxQg3Myl9JMXq6bP5bx790xe9PR3g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA16hzmSHHdVec9Y4tHIc+cw3xIJwMdSqFa1W7aF/MisAiBbTYT64+Fw98ZAp/J9Md1+vQhT0TnSaDmNne7SgmhaIg=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.3.4":{"name":"transmit","version":"0.3.4","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.0","ws":"0.4.16"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.3.4","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"5d5fa3dd26a80a26ee641ab38bdca3268d5e1783","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.3.4.tgz","integrity":"sha512-T1onb9xsFj9p1XNtxSUrvKdSrgZa+RpSjByMAZZiAoeMDYnk6/1+KG7aR5ZUvzz2M+kpJNOjpbQ2KjPRgqaoqw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID48l9ZrsaKb+cvIx/VMsSS/DZYdtrClLmPgYsU0NI5rAiAKusq/df1mIKDYLt/4roMPotuK1o6z9hgaiktb6l/EFQ=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.4.0":{"name":"transmit","version":"0.4.0","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.0","ws":"0.4.18"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.4.0","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"965e3282c6ea9d2f1b2b74af13074a65ad9d29f9","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.4.0.tgz","integrity":"sha512-yIuZDg/9fo/4ZF+hh05klAJFBN8PDKqWlq2QlaB2497a4gkByey6g+hiNK/vwkiCv+l0SPJKpxm7JvsJYjHsQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDSnFIry/RHiRBUMEarPTwhh286myaPBkLB2uuaUnPTcgIgBaiixTz7qhxd+lXiClgi9MchwPU81d1nxRm/0pPPJ8M="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.4.2":{"name":"transmit","version":"0.4.2","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":">= 0.6.0","ws":">= 0.4.18"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.4.2","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"460e0c5410374189fecd8bffcd664d7a097bd417","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.4.2.tgz","integrity":"sha512-s649LXkF/xq+vbnkL/F1rh2fZ1nqX3tMNjhzxG1I9BMpC95tMOsjaJHIdV3KCdOz3DcCkAEVVb1PvVAz0lLXfw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA1VhN2cJFp7w07BHRDJexVPiyoxxNlHzVbjzDkllnSDAiBN25TAAuEm7Ab0Oc7MviAwdc7dYBt6GmVnbjnS4id/ww=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.4.4":{"name":"transmit","version":"0.4.4","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.4","ws":">= 0.4.18"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.4.4","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"817f2dca7c0fb87c9d01ea34f938968345ad3b62","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.4.4.tgz","integrity":"sha512-72LdO8zRVr2Neol8EQb8aFa4NmLLbSTxpuw+lkYXqrG2t62Az24YJ1pBX/gEuzVyS+gPBXpkc3t855hSn+0a/A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDlKphl9rTNAPxgPU9haRwuNjg41bJSbHi8fJ6IQYC29gIhAMRx1RChzRKM6fEiW+eK+KMZ3hMa0PqfyWzUcD+Oy6qW"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.4.5":{"name":"transmit","version":"0.4.5","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.4","ws":">= 0.4.18"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"_npmUser":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"_id":"transmit@0.4.5","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"89611eff6226f85d72ad002664a430d4f12e103f","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.4.5.tgz","integrity":"sha512-sYkm9HdUqj8BqOZkL7kLPoTzwbGMr1SbcLvbw6jgeLTQcIXWdXc2SDPfNDs5dsxo3EqLU0DIJwxT9Tb0Cw+SHA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAkGxCtYzGaIpL4eNJDUKxqasnKkFjpYu3oqXaJBpeZ1AiBiDFqEk2uSCd+MmtUG+J23ptBdLH8VgV3HmfnkXVUt2g=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.4.8":{"name":"transmit","version":"0.4.8","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n,   lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.on('connection', function(socket) {\n\n    socket.send('someEvent', {\n        a:10\n    })\n\n    socket.on('someResponse', function(data) {\n        console.log(data)\n        //20\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n      transmit.on('open', function() {\n        transmit.on('someEvent', function(data) {\n            transmit.send('someResponse', data.a * 2)\n        })\n      })\n      transmit.connect('localhost:8080')\n    </script>\n  </body>\n</html>\n\n```\n\n## Server methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `connection`\n+ `error`\n+ `close`\n\n### listen (server *[http(s).Server]*, callback *[function]*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *[string]*, message *[stringifiable]*)\n\n### close\n\n## Socket methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `close`\n+ `error`\n\n### send (event *[string]*, message *[stringifiable]*)\n\n### sendBinary (data *[buffer]*)\n\n### close\n\n\n## Options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver) along with one exception: `client_script`. This option represents the name with which to expose the client script, by default, as shown in the above example, `transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_script':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\nTo prevent the client script from being served\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n","_id":"transmit@0.4.8","dist":{"shasum":"22050d699e7cddef7890f2347ccae1c9f1310a43","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.4.8.tgz","integrity":"sha512-LQQV+RjatihRPPvae+VBZApbZUb3banXLMeJmDFayQZWaymnVF8Bc0HaZY7SYZ0c/9ESoZCRzUrqLPej2q3D0w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfiXYrX/7ypVWx0tokPfgbKPrcCobUKqnhvlKaBI3uvQIhAOzga8F0G63wuX7zG3K5u8lVnVCDVl2KGsYEsBq5tKbW"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.5.0":{"name":"transmit","version":"0.5.0","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n,   lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.on('connection', function(socket) {\n\n    socket.send('someEvent', {\n        a:10\n    })\n\n    socket.on('someResponse', function(data) {\n        console.log(data)\n        //20\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n      transmit.on('open', function() {\n        transmit.on('someEvent', function(data) {\n            transmit.send('someResponse', data.a * 2)\n        })\n      })\n      transmit.connect('localhost:8080')\n    </script>\n  </body>\n</html>\n\n```\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `connection` [socket]\n+ `error` [error]\n+ `close`\n\n### listen (server *[http(s).Server]*, callback *[function]*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *[string]*, message *[stringifiable]*)\n\n### close\n\n## Socket methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `error` [error]\n+ `close`\n\n### send (event *[string]*, message *[stringifiable]*)\n\n### sendBinary (data *[buffer]*)\n\n### close\n\n\n## Options\n\n+ `ws`\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis`\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Transmit`\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\n+ `sessions` (undefined)\n\nTo integrate with express sessions using connect-redis, see the above section.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\nThis will fetch sessions on-connect and attach the `session` property to incoming sockets.\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.5.0","dist":{"shasum":"0b8bf10146fc4af711da2de7c8834d5245fa4909","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.5.0.tgz","integrity":"sha512-hKgx3OrnsvQI7eOcO8BfQKhGcLANVc76/CCs03f38ymehIzQovQ/OW09Txr4XLSjILBRsgpZJVAavLbb/jmVkw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA8buVExxUNaYIO3z4K/TSOktSQI1oLJ+Uwd/aEBpm7hAiEAz687cRmNmod8hAqhlbvDDrhUV0I1ys03/vuMBvSMYd0="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.5.2":{"name":"transmit","version":"0.5.2","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n,   lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.on('connection', function(socket) {\n\n    socket.send('someEvent', {\n        a:10\n    })\n\n    socket.on('someResponse', function(data) {\n        console.log(data)\n        //20\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n      transmit.on('open', function() {\n        transmit.on('someEvent', function(data) {\n            transmit.send('someResponse', data.a * 2)\n        })\n      })\n      transmit.connect('localhost:8080')\n    </script>\n  </body>\n</html>\n\n```\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `connection` [socket]\n+ `error` [error]\n+ `close`\n\n### listen (server *[http(s).Server]*, callback *[function]*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *[string]*, message *[stringifiable]*)\n\n### close\n\n## Socket methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `error` [error]\n+ `close`\n\n### send (event *[string]*, message *[stringifiable]*)\n\n### sendBinary (data *[buffer]*)\n\n### close\n\n\n## Options\n\n+ `ws`\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis`\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Transmit`\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\n+ `sessions` (undefined)\n\nTo integrate with express sessions using connect-redis, see the above section.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\nThis will fetch sessions on-connect and attach the `session` property to incoming sockets.\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.5.2","dist":{"shasum":"4f8eaf89d8689531a3f5e1ae7fd175b3166ff830","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.5.2.tgz","integrity":"sha512-LaJE+uE4xQ+UqzaqHRjIp/uS9KNidQYqaegYN11nFYyJuDHAUDZW+LChGPMYt62P/0fqM/xpP5dGLT+TjWXC4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCrAU2byuxL7ysQnoHX9r/IVLncxAp+7LP04GVRukTZngIgSiyxNzL0uRsbcheoHSSPkX2PSa6ktpD6Uqr+Mb8kRzo="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.5.3":{"name":"transmit","version":"0.5.3","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n,   lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.on('connection', function(socket) {\n\n    socket.send('someEvent', {\n        a:10\n    })\n\n    socket.on('someResponse', function(data) {\n        console.log(data)\n        //20\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n      transmit.on('open', function() {\n        transmit.on('someEvent', function(data) {\n            transmit.send('someResponse', data.a * 2)\n        })\n      })\n      transmit.connect('localhost:8080')\n    </script>\n  </body>\n</html>\n\n```\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `connection` [socket]\n+ `error` [error]\n+ `close`\n\n### listen (server *[http(s).Server]*, callback *[function]*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *[string]*, message *[stringifiable]*)\n\n### close\n\n## Socket methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `error` [error]\n+ `close`\n\n### send (event *[string]*, message *[stringifiable]*)\n\n### sendBinary (data *[buffer]*)\n\n### close\n\n\n## Options\n\n+ `ws`\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis`\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Transmit`\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\n+ `sessions` (undefined)\n\nTo integrate with express sessions using connect-redis, see the above section.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\nThis will fetch sessions on-connect and attach the `session` property to incoming sockets.\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.5.3","dist":{"shasum":"86035dbe6ed4d57b4b6cb2fe7a02ce8e6da673c4","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.5.3.tgz","integrity":"sha512-rmQXK1B3j4VQ5lmOHtCeNYHrPj1V5E5O1aIjlTiT6daZpwR2fDle+3rGlRFU+bVQ+SWleZYGTNU23tShfMbxnA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG1YvN58TEgvvEUSaB123bIoHSXAf4tlc0xOUoPgtHtFAiEAkMFLFgLX/Dv//C+Q67fQwJerFSC0wjKnyxmYzOU/h5A="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.5.4":{"name":"transmit","version":"0.5.4","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n,   lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.on('connection', function(socket) {\n\n    socket.send('someEvent', {\n        a:10\n    })\n\n    socket.on('someResponse', function(data) {\n        console.log(data)\n        //20\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n      transmit.on('open', function() {\n        transmit.on('someEvent', function(data) {\n            transmit.send('someResponse', data.a * 2)\n        })\n      })\n      transmit.connect('localhost:8080')\n    </script>\n  </body>\n</html>\n\n```\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `connection` [socket]\n+ `error` [error]\n+ `close`\n\n### listen (server *[http(s).Server]*, callback *[function]*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *[string]*, message *[stringifiable]*)\n\n### close\n\n## Socket methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `error` [error]\n+ `close`\n\n### send (event *[string]*, message *[stringifiable]*)\n\n### sendBinary (data *[buffer]*)\n\n### close\n\n\n## Options\n\n+ `ws`\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis`\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Transmit`\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\n+ `sessions` (undefined)\n\nTo integrate with express sessions using connect-redis, see the above section.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\nThis will fetch sessions on-connect and attach the `session` property to incoming sockets.\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.5.4","dist":{"shasum":"5967e9a95db08ef9c8b71a094fa1c9583d84d3fe","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.5.4.tgz","integrity":"sha512-47zElIYGGLw1+N+IAjyznXZEJtYdhAgQ62WqWLnCQGGfR4x6/tRPnCdKzJUVyU9PWU+XNggAggPDPdm/V6hvUg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICLP5RrWaE8HLAQ5r5b6jbVsWd7Rf6wmZixbJVLWBAbVAiAWvY91bBp0UNLUycHCrihZExU8PuscbExwTjjsBHs8Pg=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.5.5":{"name":"transmit","version":"0.5.5","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n,   lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.on('connection', function(socket) {\n\n    socket.send('someEvent', {\n        a:10\n    })\n\n    socket.on('someResponse', function(data) {\n        console.log(data)\n        //20\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n      transmit.on('open', function() {\n        transmit.on('someEvent', function(data) {\n            transmit.send('someResponse', data.a * 2)\n        })\n      })\n      transmit.connect('localhost:8080')\n    </script>\n  </body>\n</html>\n\n```\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `connection` [socket]\n+ `error` [error]\n+ `close`\n\n### listen (server *[http(s).Server]*, callback *[function]*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *[string]*, message *[stringifiable]*)\n\n### close\n\n## Socket methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `error` [error]\n+ `close`\n\n### send (event *[string]*, message *[stringifiable]*)\n\n### sendBinary (data *[buffer]*)\n\n### close\n\n\n## Options\n\n+ `ws`\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis`\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Transmit`\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\n+ `sessions` (undefined)\n\nTo integrate with express sessions using connect-redis, see the above section.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\nThis will fetch sessions on-connect and attach the `session` property to incoming sockets.\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.5.5","dist":{"shasum":"73f87f1ae1faa0bb60b2a9e79c784c3242ba3fde","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.5.5.tgz","integrity":"sha512-sJsK+tNg2E3yzPj8TnZEJNaNvisNJ8UIcKvAAJy6bZSo0M0jPFtN7JvjyHlT2mbJX4O6sMD63qp68YNAmd4kkA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCwDJdXF0KLdLjic6Q0pgkDppMCJnok3EpiDThlsQtSQIhAJf4DfqRRgXN6ktX3UyjGzM6LJ8SOErZMfoLJeWYrNwQ"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.0":{"name":"transmit","version":"0.6.0","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n,   lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.on('connection', function(socket) {\n\n    socket.send('someEvent', {\n        a:10\n    })\n\n    socket.on('someResponse', function(data) {\n        console.log(data)\n        //20\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n      transmit.on('open', function() {\n        transmit.on('someEvent', function(data) {\n            transmit.send('someResponse', data.a * 2)\n        })\n      })\n      transmit.connect('localhost:8080')\n    </script>\n  </body>\n</html>\n\n```\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `connection` [socket]\n+ `error` [error]\n+ `close`\n\n### listen (server *[http(s).Server]*, callback *[function]*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *[string]*, message *[stringifiable]*)\n\n### close\n\n## Socket methods\n\n### on (event *[string]*, callback *[function]*)\n\nApplicable events\n\n+ `error` [error]\n+ `close`\n\n### send (event *[string]*, message *[stringifiable]*)\n\n### sendBinary (data *[buffer]*)\n\n### close\n\n\n## Options\n\n+ `ws`\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis`\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Transmit`\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\n+ `sessions` (undefined)\n\nTo integrate with express sessions using connect-redis, see the above section.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\nThis will fetch sessions on-connect and attach the `session` property to incoming sockets.\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.0","dist":{"shasum":"18cc1004543aef7e3ae510181251b20e8a00385f","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.0.tgz","integrity":"sha512-g153Nr/Tzq/MUN2324h4r0oSkHYG3LDlSUImALNVd5PS3yECwyvWqNcb1JJA4FbQqcrrKBLdJJGMU7FUibIukA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCofOyGCt/26zjTYp+DL1shX+bQk+Av995ZmbmAb1J3bgIhAJzHc04dVTJvLNmmHsvJKbz9eNQQXG75+cfxgNHxC4KF"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.1":{"name":"transmit","version":"0.6.1","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', function(data, ev) {\n        this.respond(ev, true)\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* true */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.1","dist":{"shasum":"0fd66826ff6321e348efc837441db5700681d44c","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.1.tgz","integrity":"sha512-H9nFAvJp84Qy/P+3iVinLmy7eaXMH10VqEPHy/f8Z9w+q2u9wE0ty1fGFXiccLVRXxu1qtv2Q3ZgqgXpi2qRuQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDu4GBnowB2CwTZg0Z0GSYZguDMkXg0o89zc/jdSLnHGgIhAOqqcBAIR/AwjBH2KDjd6ilkROzI31QXY7sLtJPAKdbE"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.2":{"name":"transmit","version":"0.6.2","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', function(data, ev) {\n        this.respond(ev, true)\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* true */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.2","dist":{"shasum":"97e5cc4eb3d5e7fe737920af1d197bf87f53adec","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.2.tgz","integrity":"sha512-ycr+zjIRU+zUQCdZvHmejRqlk2ooGh/T4dPW0KQC10v4BXV3y/T1CNNSfugQzYhU50INIiFE7HujOlFiTqOXaA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBIdUoA3t1wUg5wvZ2cWgWt2mno27GC2mU1Rb1gWoINKAiEA+EpW0t5fmaWx/ZsPVruHK9Qy4nBcGrqCyYXBLx1eolM="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.3":{"name":"transmit","version":"0.6.3","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', function(data, ev) {\n        this.respond(ev, true)\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* true */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.3","dist":{"shasum":"914e82583db862e6dda667a510254fda62923e60","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.3.tgz","integrity":"sha512-tlGp6E+A1rgrpR92+zMqkSzXnCQ5LOun1I9gTpTwFtd1XoeoW/pTpkrxtdPnpjCM9OJf3zVIAHXT5wA121uXUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDaLxa23w3sI0DExYSMcSMalZCi2S2ASB8BbYp0fJ7/QwIhAODf7AnuNbuz8tPS6Zx3pD3Svi7HhaWd2rMNmWJ5Bygd"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.5":{"name":"transmit","version":"0.6.5","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', function(data, ev) {\n        this.respond(ev, true)\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* true */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.5","dist":{"shasum":"4dbf05d7525d955767f4542181f35beb8143d97a","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.5.tgz","integrity":"sha512-hZ7IDaAVZX+Vix9f8lTNIuO+eeMonJuSGbGwsHWIhQ95wrppQVYp19cQu8cw+qlqsM3B7YAPeZiNfVjClYQAQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDI+nNOMLMC67CJ0U198euOAvWIOSynBF0lMZiYhH5X/QIhAKmdjv+7K9uAex14X/VBHMdLSNFK+bcT8yhr3xVIDIH3"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.6":{"name":"transmit","version":"0.6.6","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, and client broadcasting.\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.6","dist":{"shasum":"0f422b0c8f2c0223eeba7def7aa0bf3c765e4216","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.6.tgz","integrity":"sha512-evy7VxcnlPh5bCcYnZ7ToDirnjEtbpnMxuviXRvjP3UIV5iqZQzqYdpDRGkoMh2gmsbLNM7/5QORfKSZ8E8Ung==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGjvmd4BlX4O9ZTiUQUSesLfa/FJPjtgkrR7vqGt3BRjAiEA65f0QMctghR8+hfA5SnNP7Wr7N1Snl7ZpWQ3ao4S3jA="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.7":{"name":"transmit","version":"0.6.7","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.20"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, and client broadcasting.\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.7","dist":{"shasum":"1896719480d2c67396b6a493b0b61712ab057f51","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.7.tgz","integrity":"sha512-BxfVuiedLTJ4SUeflod7mRDW79i0CHCzpU31ymCLdbAjs0OnKXW2ebSaYvXDI5Kpopqr4M1J0SVsNcpMDs49rw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICzm4Ya+ivjKZvEViznPRCq4NX9F2YDF4wFuxA4s8w9qAiB1f3RyXf8JPHB34eTUGQrKbZUwyreVt+ppgwmt9JNKcg=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.8":{"name":"transmit","version":"0.6.8","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.21"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, and client broadcasting.\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.8","dist":{"shasum":"14b6a93870a6645e5d4b5fabfa3216e0a1119b2b","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.8.tgz","integrity":"sha512-RH3SsTNLl1GUn+kZvAWSnWHi5GvyI2G6KlC1obr4H72DAv0QGCQJR4S7Zniq1Aug0donVa4j9Ta7PJX3o3GuQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDscF56kMoYbhn3G5aqEd3awiaZknPU4yqR/BI5R0z4UAiAWkvIft1ZXOGnedYgQP1zYlJq4YFGu50jMQNqA82s19Q=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.9":{"name":"transmit","version":"0.6.9","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.21"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, and client broadcasting.\n\n*Incompatible with Express beta*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.9","dist":{"shasum":"c1c20fe1db412b52487e0b4cd1dc264048de15b0","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.9.tgz","integrity":"sha512-s+xAmfhOY5gX94GI+aZEjSOTYSPFk1JRkUjXSTDkm8Sb0LSZ3fLh8B3bmtC42opT9JBHX2cR4yjXGyHq4ffZSw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDIbt7sHcioUzKCTLKQ7uoiy/i+1jkiNOCTjHS0AwgnFAiBxkIfwYssxXuD5OfoJ+SkI3E+DKFqEN1IvEm+3XDfoSg=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.10":{"name":"transmit","version":"0.6.10","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.21"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, and client broadcasting.\n\n*Incompatible with Express beta*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.10","dist":{"shasum":"164ed6386b07e0ec50b19b6e29f817ae84f3fc2d","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.10.tgz","integrity":"sha512-2v4HKW5XG5aUShSbdfRDYaV5UyrszvgDKXq16cSn/1WWdLhX8vBj8S3rxPJSbJCynjtymkY8Old5a/wbuaqJJQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAu/kE9Oxl8xCkhNiQ2s+jrBX3/+Bi5C0OyL+IviDsKnAiEA1s7eOqxDpwyCAE1QPqD5Jtse+6hNR71oU3zVxetWhII="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.6.11":{"name":"transmit","version":"0.6.11","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.21"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, and client broadcasting.\n\n*Incompatible with Express beta*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit(window.location.host)\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen it's quite simple!\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### close\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nIf a callback is provided, Transmit will handle things accordingly. For example, if your server-side looks like this:\n\n```js\nsocket.on('msg', function(msg){})\nsocket.send('msg', 'asdf', function(res) { })\n```\n\nAnd your client-side like this:\n\n```js\nsocket.on('msg', function(stuff, ev) {\n   this.respond(ev, 'myResponse') \n})\n```\n\nYour 'msg' listener on the server-side will not be called. Only the callback within `send` will be called. Transmit differentiates between original messages and responses *to* messages.\n\n### sendBinary (data *buffer*)\n\n### respond (event *string*, message *stringifiable*)\n\nThis method is for responding to messages already sent, for example, from within the callback of an on(msg) listener. The client will differentiate between original messages and responses *to* messages.\n\n### close\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.6.11","dist":{"shasum":"31f86799c6dddb1b0a782382506e796fcc26eac7","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.6.11.tgz","integrity":"sha512-q5PtViYvfFppgWYHZkG9N/G8Ay7ZEO7JqUJPMfaD3Xwyw52owjORVb8ur4tx/W28CcFuSIlddsQgmpyoqm55uw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4vNo/IZMAVXzEcQFyg0SDEXMrC7vql64wWFIcyB4elQIgc6ll0FgJyoAnARZQ0tKdENduvSgkHnDVFwOEpeRoh1o="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.7.0":{"name":"transmit","version":"0.7.0","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.21"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, client grouping, and broadcasting.\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.7.0","dist":{"shasum":"29e1338b7e53e54bdef6eabb2b02655222d20ea8","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.7.0.tgz","integrity":"sha512-YT0lYgEln1WLo1vv7goZgeYl3p0qC4ypBQ3vU0JW4c46WOtmDUX5nJtXYvaNTM+8xo9lCgqNgD4VbTiQQg85eA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsXZqvF6YUrr1cITAiQeQsCyXG3P+9B+bRRPPlxyGROgIhANVE4nSAga25cSQ/Zjdj0bkUz4DCE/UGmdhG2qYCOkaN"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.7.1":{"name":"transmit","version":"0.7.1","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.21"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, client grouping, and broadcasting.\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.7.1","dist":{"shasum":"54dfa683e6b3454a88f79b53941bb050a34a907f","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.7.1.tgz","integrity":"sha512-qG9Sh5C2GJm61tpb1QYgWE+3Zepp5eKWw0HpYUDiHwoucWBrjz6WnfCKRYNauD2AkIVIwqe0FsFH/3A8N5GUvg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDbkhm3H2F5d5xO4s0zCTawrdi3S+QPmSsOlfi85gkI9AiABxsv6bXI9lX+Dvp3Ai3DAO/iXUN7e+eDn86CbgSaN5Q=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.7.2":{"name":"transmit","version":"0.7.2","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.21"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, client grouping, and broadcasting.\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.7.2","dist":{"shasum":"38f60cd3b846cf2ba1c4b2c31c3d78d9a4851956","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.7.2.tgz","integrity":"sha512-HRQRGBvTGKRl+yOnvyR9zRff77FLAYd1spsgZya4eV9VQU2iMoAloIHF1QnnYdY1FHe941FPISxzGjEZZwYPag==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHpdl6Y9iQ/FXkhXF/CHMZ47sNzNWHskvVGxKdL5SlanAiAr9or9TdbZTbG+kxGfdjLm0uZ8WkqU3guW22ZrPVQAMw=="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.7.3":{"name":"transmit","version":"0.7.3","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.6.8","ws":"0.4.21"},"devDependencies":{"mocha":"latest","should":"latest"},"main":"lib/transmit.js","engines":{"node":">= 0.4.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, client grouping, and broadcasting.\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.7.3","dist":{"shasum":"c87e858195e6ad0561b66ac551e115a88aee09a0","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.7.3.tgz","integrity":"sha512-BiLDrOVf+X68FtHvxuwuGBLHdHoCiNonZjfij+iZq7UR/e1Dq+jvQM+kG/D8k+h0kPxTgxUtytqa9anNzMLj/g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDjC9eQW/h+5IuP5gyizRPRk22Wr9nJ8bHcQdYH3fuZmwIhAPdU0y8vx+/mVS2Y5liEm3GGOORWjYJizLwZfXtYxro8"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.7.4":{"name":"transmit","version":"0.7.4","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.8.11","ws":"0.4.21"},"devDependencies":{"mocha":"latest","should":"latest"},"main":"lib/transmit.js","engines":{"node":">= 0.5.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, client grouping, and broadcasting.\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.7.4","dist":{"shasum":"50f8e10df4770740849cb0598edcf539db0c6b11","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.7.4.tgz","integrity":"sha512-Zx3N2mCdjfspQO/4cZRWr4wV98vJIIqBUMNF8QhNcV9d+ST097wxYvK/ymobshpxgCPF1GHZwaPn8ERsQbqJFA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBsTM2T0ZZ+E1zgyAZCVwhujr54r/ZE7WbN7OIHwB4MbAiEAsL9Mh3z6kOARJkf3sMsTebMWhfH2cM2DLIv13NRTn0o="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.7.5":{"name":"transmit","version":"0.7.5","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.8.11","ws":"0.4.21"},"devDependencies":{"mocha":"latest","should":"latest"},"main":"lib/Transmit.js","engines":{"node":">= 0.5.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, client grouping, and broadcasting.\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.7.5","dist":{"shasum":"42859118a67980429f735c0959af9977fa01fb5c","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.7.5.tgz","integrity":"sha512-hHm8n77YTKhf+thzXOX3yTAXG0CUBfg03izHuOBhcAQMrrXFl5zojjxIj0gyhMywOOIyeEhJoZYtk9SNanWvwQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDZW4z0kFtggP/mfik/70ZWH4Hcak0cquJy84z9g+PrjAiEAmdzZDSd76QEYb4LsNEkYLnHgiAoM9AkXtSCnb7REb+k="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.8.0":{"name":"transmit","version":"0.8.0","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.8.11","ws":"0.4.21"},"devDependencies":{"mocha":"latest","should":"latest"},"main":"lib/Transmit.js","engines":{"node":">= 0.5.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, client grouping, and broadcasting.\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.8.0","dist":{"shasum":"cd3b944199a425f724c339bbd840ad0f47c2ac1a","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.8.0.tgz","integrity":"sha512-zO25e7Sd9QwvGdM/JBF3o0/8Dkz//CGj8UwGr/NMmBAAMY7WuJ/4pzwC53dhWsplJ5iyjgQVuawOvq9ve3Ug7A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDgn2okzJLtKRzHgTV7b+hRJ6wRw1+wfOQ0RAdru0IrigIgB5yXzQKkuJvbXgetgTd0xKEc1uknzctijx4o9rnJwS4="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.8.1":{"name":"transmit","version":"0.8.1","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.8.11","ws":"0.4.21"},"devDependencies":{"mocha":"latest","should":"latest"},"main":"lib/Transmit.js","engines":{"node":">= 0.5.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures include pseudo-callback behavior, simple integration with express sessions, client grouping, and broadcasting.\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.listen(app, function(socket) {\n\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.8.1","dist":{"shasum":"9a95544e14d3802eb3f5ebb551f52a3db477da87","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.8.1.tgz","integrity":"sha512-z1alEXLnxfQNV1eZOhYrCy5sIUnCKQi4V3JXqcFCR3OlvLssbWCkeP6jJEM9KaYVsIJse2ee6fRh+ZztMPeq6w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNsLhB9yDDFsPtfEFGlPeoYL5rkbucd8QMtZ5J79dHyAIgVTMeVMZzqEDcelXW88g6srcpqrxaS82hiuYjylSRCjU="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.8.2":{"name":"transmit","version":"0.8.2","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.8.11","ws":"0.4.21"},"devDependencies":{"mocha":"latest","should":"latest"},"main":"lib/Transmit.js","engines":{"node":">= 0.5.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures:\n\n+ Callback behavior\n+ Integration with sessions\n+ Client grouping\n+ Broadcasting\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\ntransmit.listen(app, function(socket) {\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\nTo query Redis for sessions after the client has connected:\n\n```js\ntransmit.on('connection', function(con) {\n    transmit.getSession(con, function(err, session) {\n\n    })\n})\n```\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.8.2","dist":{"shasum":"0ea5e843b4a9d3a20e3d757ffe01b34452230e2a","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.8.2.tgz","integrity":"sha512-9qhAs5n5HP/ox4duKXwr0vua78DKNxRKdclPVt513mz7m12E2gegSjW7qaXrqlwdOIrSaIKc9/vQukf/Skx4Qw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvZC+h1j6Dz2i950mI0Zm/2S/xCMF4P++M8OjaGpZmtQIhAK/HHevGHyKg3csCQqOHLZCiQXlYumhAzulHzuM3J3ca"}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]},"0.8.3":{"name":"transmit","version":"0.8.3","description":"Simple and fast websocket abstractions for server & client","keywords":["websocket"],"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"dependencies":{"lactate":"0.9.8","ws":"0.4.21"},"devDependencies":{"mocha":"latest","should":"latest"},"main":"lib/Transmit.js","engines":{"node":">= 0.5.0"},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\nFeatures:\n\n+ Callback behavior\n+ Integration with sessions\n+ Client grouping\n+ Broadcasting\n\n*Incompatible with Express beta, make sure that you are using Express 2.5.x*\n\n## Basic example\n\n### Server\n\n*server.js*\n\n```js\n\nvar express = require('express')\n,   app     = express.createServer()\n\nvar lactate = require('lactate')\n\napp.get('/', function(req, res) {\n  return lactate.file('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\ntransmit.listen(app, function(socket) {\n    socket.on('request', data, cb) {\n        cb('Greetings')\n    })\n})\n\n```\n\n### Client\n\n*index.html*\n\n```html\n\n<!doctype html>\n<html>\n  <head>\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n  </head>\n  <body>\n    <script>\n    var $t = transmit()\n    $t.on('open', function() {\n        $t.send('request', 'asdf', function(res) {\n            alert(res) /* 'Greetings' */\n        })\n    })\n    </script>\n  </body>\n</html>\n\n```\n\n\n## Integrating with express sessions\n\nTo integrate express sessions with Transmit, first make sure you have `node_redis` and `connect-redis` modules installed.\n\n`npm install redis hiredis connect-redis`\n\nThen simply set `sessions` to `true` in the Transmit options.\n\n```js\nvar express = require('express')\nvar app = express.createServer()\n\nvar RedisStore = require('connect-redis')(express)\n\napp.use(express.cookieParser())\napp.use(express.session({\n    store:new RedisStore()\n    secret:'somn'\n})\n\napp.get('/', function(req, res) {\n    req.session.user = Math.random().toString(36).substring(2)\n    res.end(landingPage)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.on('connection', function(socket) {\n    var user = socket.session.user\n})\n\ntransmit.listen(app)\n```\n\nTransmit parses incoming connection headers to find the connect session ID, queries Redis for the session data, and JSON parses it. Transmit is then loosely-coupled to your express app.\n\nTo query Redis for sessions after the client has connected:\n\n```js\ntransmit.on('connection', function(con) {\n    transmit.getSession(con, function(err, session) {\n\n    })\n})\n```\n\n## Grouping clients\n\nTransmit allows you to group clients any way you like, by exposing a mapping function. Combined with Express sessions this can be quite convenient. Example.\n\n```js\n\nfunction attachURL(req, res, next) {\n    req.session.url = req.url\n    return next()\n}\n\napp.get('/', attachURL, function(req, res) {\n    /* Send landing page with Transmit script */\n})\n\nvar transmit = require('transmit')({\n    sessions:true\n})\n\ntransmit.group(function(client) {\n    return client.session.url\n})\n\ntransmit.listen(app, function(client) {\n    client.peers(function(peer) {\n        peer.send('greet', 'Greetings')\n    })\n})\n\n```\n\n## Server methods\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `connection` socket\n+ `error` error\n+ `close`\n\n### listen (server *http(s).Server*, callback *function*)\n\nCallback function is executed for every connection with one argument: the connecting socket\n\n### broadcast (event *string*, message *stringifiable*)\n\n### group (fn *function*)\n\nThis method will map your clients into groups, using `fn`. In the following example your clients will be grouped by the `someProperty` property of their session object (assuming sessions have been enabled). To access a group you may use either Transmit's `of` method or the `peers` method attached to Transmit clients.\n\n```js\n\ntransmit.group(function(client) {\n    return client.session.someProperty\n})\n\n```\n\n### of (group *string*)\n\nReturns an array of clients by group name.\n\n### close\n\nClose the server\n\n## Socket methods\n\nThese methods exist on both the client and server-side.\n\n### on (event *string*, callback *function*)\n\nApplicable events\n\n+ `error` error\n+ `close`\n\n### send (event *string*, message *stringifiable*, callback *function*)\n\nThe `send` method automatically stringifies your second argument. An optional third argument is for callback function.\n\nTransmit's stringification format is: `JSON.stringify([event, data])`\n\n*Server* \n\n```js\n    socket.on('requestMilk', function(req, res) {\n        res('Try again soon')\n    })\n```\n\n*Client*\n\n```js\n    transmit.send('requestMilk, 'please', function(res) {\n        alert(res === 'Try again soon') /* true */\n    })\n```\n\n### sendBinary (data *buffer*)\n\n### peers (fn *function*)\n\nWithout a callback this function returns an array containing the client's peers. Otherwise, your callback will be executed for every peer.\n\nWhile using a callback to broadcast to a peer group, note that to avoid Transmit's automatic stringification you may use the native `send` method attached to the `socket` property. At this level Transmit behaves just like the `ws` module. However, note also that Transmit stringifies in the format described above.\n\n```js\n    var ids = socket.peers().map(function(i) { return i.clientId })\n\n    var dataString = JSON.stringify([\n        'someEvent',\n        'someData'\n    ])\n\n    socket.peers(function(peer) {\n        peer.socket.send(dataString)\n    })\n```\n\n### close\n\nClose the client\n\n\n## Options\n\n+ `Transmit` options\n\nThe `client_name` option refers to the  name with which to expose our client script. By default, the client script is accessed from `/transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_name':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\nTo prevent the client script from being served, use `no_client`\n\n```js\nvar transmit = require('transmit')({\n    no_client:true\n})\n```\n\nTo integrate with express sessions using connect-redis, set `sessions` to true.\nThis will automatically fetch sessions from connect-redis and attach the `session` property to incoming sockets.\n\n```js\nvar transmit = require('transmit')({\n    sessions:true\n})\n```\n\n+ `ws` options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available `ws` options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver)\n\n+ `node_redis` options\n\nTransmit uses Redis (node_redis) to fetch sessions from a `connect-redis` session store. If you don't care about sessions, these options don't apply to you. If you do care about integrating sessions, see the section above on that topic.\n\nYou may pass options to node_redis by way of the `redis` property. See available options [here](https://github.com/mranney/node_redis#rediscreateclientport-host-options)\n\n```js\nvar transmit = require('transmit')({\n    redis: {\n\n    }\n})\n```\n\n+ `Lactate` options\n\nFor serving the client script, Transmit relies on [Lactate](https://github.com/Weltschmerz/Lactate).\nYou may set Lactate options using `lactate` like so\n\n```js\nvar _transmit = require('transmit')({\n    lactate: {\n        expires:'one year'\n    }\n})\n```\n\n\nA complex options example:\n\n```js\n\nvar options = {\n    port:2112,\n    client_name:'MyScript',\n    sessions:false,\n\n    lactate: {\n        expires:'two days',\n        cache:false\n    },\n\n    redis:{\n        parser:'javascript',\n        no_ready_check:true\n    }\n}\n\nvar transmit = require('transmit')(options)\n```\n","_id":"transmit@0.8.3","dist":{"shasum":"289c01d2e47c99511551b294ae9b5c115a587950","tarball":"https://registry.npmjs.org/transmit/-/transmit-0.8.3.tgz","integrity":"sha512-UH304rRZcYiAMxnmfk7yLIWC5lN3v2RTwg7jg8k6v1UM9S1+c+YKfZPi5szVSEEomY/kQ9XjFrnOtIRg7qbzhg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCa6osKzq6Ex8J9WX2DNWpL7RxyA1RxUwfFFEzBqbZr5wIgb3QTiHAZaTVWa/BB7lE7okKvj50/dGbOJTuMyB7sKV0="}]},"maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}]}},"readme":"## Transmit\n\n`npm install transmit`\n\nTransmit is two things:\n\n+ Abstractions on top of the [ws](https://github.com/einaros/ws) library\n+ A similar set of abstractions for the client, automatically exposed\n\n### The server\n\n```js\n\nvar express = require('express')\n,   app = express.createServer()\n\nvar lactate = require('lactate').Lactate({\n    expires:'two days'\n})\n\napp.get('/', function(req, res) {\n  return lactate.serve('index.html', req, res)\n})\n\napp.listen(8080)\n\nvar transmit = require('transmit')()\n\ntransmit.on('connection', function(socket) {\n\n  socket.on('someEvent', function(data) {\n\n    socket.send('someResponseEvent', {\n        success:true\n    })\n\n  })\n\n})\n\ntransmit.listen(app)\n\n```\n\n### The client\n\n```html\n\n<!doctype html>\n\n<html>\n\n  <head>\n\n    <title>Transmit example</title>\n    <script src='/transmit'></script>\n\n  </head>\n\n  <body>\n\n    <script>\n\n      transmit.once('open', function() {\n\n          transmit.on('someResponseEvent', function(data) {\n            console.log('someResponseEvent!', data)\n            //{success:true}\n          })\n\n          transmit.send('someEvent', ':|')\n      })\n\n      transmit.connect('localhost:8080')\n\n    </script>\n\n  </body>\n\n</html>\n\n```\n\n## Options\n\nTo set `ws` options, you may pass them to the initialization function like so\n\n```js\nvar transmit = require('transmit')({port:2112})\n```\n\nYou can find all of the available options [here](https://github.com/einaros/ws/blob/master/doc/ws.md#class-wsserver) along with one exception: `client_script`. This option represents the name with which to expose the client script, by default, as shown in the above example, `transmit`. \n\n```js\nvar id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'\n\nvar transmit = require('transmit')({\n    'client_script':id\n})\n\n/*\n    The script can now be accessed from \n    /to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave\n*/\n```\n\n\n","maintainers":[{"name":"Weltschmerz","email":"chlavois@gmail.com"}],"time":{"modified":"2022-06-27T20:29:27.280Z","created":"2012-06-09T10:34:18.688Z","0.1.4":"2012-06-09T10:34:19.004Z","0.2.0":"2012-06-09T12:17:33.909Z","0.2.2":"2012-06-09T12:42:00.803Z","0.2.4":"2012-06-12T08:34:01.940Z","0.2.5":"2012-06-12T08:59:22.485Z","0.3.0":"2012-06-13T09:03:48.427Z","0.3.2":"2012-06-13T09:59:52.272Z","0.3.4":"2012-06-13T12:07:56.655Z","0.4.0":"2012-06-15T10:01:59.131Z","0.4.2":"2012-06-17T07:00:03.614Z","0.4.4":"2012-06-17T09:29:37.191Z","0.4.5":"2012-06-18T21:37:37.754Z","0.4.8":"2012-06-30T23:58:18.983Z","0.5.0":"2012-07-04T01:55:05.011Z","0.5.2":"2012-07-04T05:04:20.484Z","0.5.3":"2012-07-04T06:42:53.660Z","0.5.4":"2012-07-04T06:45:14.749Z","0.5.5":"2012-07-04T06:47:06.560Z","0.6.0":"2012-07-05T07:42:09.190Z","0.6.1":"2012-07-05T09:45:08.449Z","0.6.2":"2012-07-05T14:14:52.331Z","0.6.3":"2012-07-06T01:21:29.764Z","0.6.5":"2012-07-07T01:55:22.165Z","0.6.6":"2012-07-07T02:03:40.241Z","0.6.7":"2012-07-08T03:36:55.932Z","0.6.8":"2012-07-15T13:01:22.544Z","0.6.9":"2012-07-16T15:22:44.005Z","0.6.10":"2012-07-16T15:36:59.561Z","0.6.11":"2012-07-16T16:15:55.340Z","0.7.0":"2012-07-17T17:46:35.221Z","0.7.1":"2012-07-17T17:53:08.311Z","0.7.2":"2012-07-18T16:39:49.817Z","0.7.3":"2012-08-09T00:09:14.144Z","0.7.4":"2012-08-09T15:58:55.236Z","0.7.5":"2012-08-09T16:45:52.785Z","0.8.0":"2012-08-11T14:43:41.451Z","0.8.1":"2012-08-14T18:57:42.580Z","0.8.2":"2012-08-16T00:48:56.604Z","0.8.3":"2012-08-31T22:33:10.567Z"},"author":{"name":"Weltschmerz","email":"chlavois@gmail.com"},"repository":{"type":"git","url":"git://github.com/Weltschmerz/Transmit.git"}}