{"_id":"@amazebot/rocket-socket","_rev":"3-ff2527f60a65f048cb34281467ad3eac","name":"@amazebot/rocket-socket","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.1":{"name":"@amazebot/rocket-socket","version":"0.0.1","description":"Communicate with Rocket.Chat Realtime API via websocket (DDP).","homepage":"https://github.com/Amazebot/rocket-control/tree/master/packages/socket","repository":{"type":"git","url":"git@github.com:Amazebot/rocket-control.git"},"author":{"name":"Tim Kinnane","email":"tim.kinnane@amazebot.chat"},"license":"MIT","engines":{"node":"> 8.0.0","npm":"> 5.0.0"},"main":"lib/index.js","types":"lib/index.d.ts","keywords":["rocket.chat","chat","chatops","messaging","CUI","typescript","DDP"],"publishConfig":{"access":"public"},"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","add:local":"yarn add --registry http://localhost:4873"},"dependencies":{"@amazebot/config":"^0.1.1","@amazebot/logger":"^0.1.1","@types/ws":"^6.0.1","ws":"^6.1.2"},"gitHead":"6606c93ef8935125632c4b6359390cc702c29801","_id":"@amazebot/rocket-socket@0.0.1","dist":{"shasum":"1912f78ae47429732a62dc9acf1ed7e7e8ba0bcf","integrity":"sha512-KqqJ6DWXy+CGqFHV+Ot4e2+leR2JNPOIZvPCiRdCYwk3mTF5d/LgdmtLL5WWfioYDueAhiYjkEj8N2K9RDbjmQ==","tarball":"https://registry.npmjs.org/@amazebot/rocket-socket/-/rocket-socket-0.0.1.tgz","fileCount":22,"unpackedSize":38212,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcD6rqCRA9TVsSAnZWagAAYqMP/1O01EDLkIGHDbgcrHit\n8CfqPXXbcGtMYFxnMzmnY40q/H5W3TfGcZhtJS/78cK04IwspQHT1twQuWhW\nVzgSDlitNWHrywQgl6+1RJ6xJ5a5ckCZEojgjMw5KOHEXxrDRyeiAcyYJhAk\nOuJ0fwQXYHI8hNh97WivXp5xd/44aXXLxoSthMypISivUMdiPYKVlqlK3nqy\nkBLEnbGsAih0uIVJXpSK9W6gSmuvetz+FaCNiLo/P07FX2a9IZXoawNRKKjk\nz6Yp7jdmjIEkJXh0z1jt6bqp/y2e93w+MgKJ+EzB2D0Vp4NPmLq3+vDW+EYP\nawaWEOrOwBwfzBuk3rpAUvko1OlwKvNnmXuddoNeUKfYNRekVhj46QrlGBoj\nLEapnTmC5M8LixpUXI8OaThXPj0siUw7yV0y8PBB8fuwNhtSyCRU0uVxXD1J\n9/rOmIgCcL6YfFhqJ69LDUYsUPDE9+8OaKqS7/Gqd0NZLB4nj6NbCf4bpeQv\nF1QNGCdbrX//wHp4VWZBkW5lfB99K5u9H3T0h8tHP4rsy4rQrqhuebYr7kyG\nUV4K3UACDj0vaDJvP1Fc9VEVJ0KhC74+HZYl3m/p2ziAwe+3iYoKrpHV6V2W\n95AVGbbAUO0lk1YUFBkLmaTNg4iJMvFAoTU1DfeUzFF/BY0c1lWXH7+OhjEz\nGIN+\r\n=q0U1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGx4DtZRzWj+LfhvlsRItMdXTOlWHEJ83EburUXxPeezAiEAgU5YxqKaDap0N20aeK6sRH/miQ7UakhcwiaX98uryVM="}]},"maintainers":[{"name":"timkinnane","email":"timkinnane@gmail.com"}],"_npmUser":{"name":"timkinnane","email":"timkinnane@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rocket-socket_0.0.1_1544530665665_0.03088172878200912"},"_hasShrinkwrap":false},"0.1.0":{"name":"@amazebot/rocket-socket","version":"0.1.0","description":"Communicate with Rocket.Chat Realtime API via websocket (DDP).","homepage":"https://github.com/Amazebot/rocket-control/tree/master/packages/socket","repository":{"type":"git","url":"git+ssh://git@github.com/Amazebot/rocket-control.git"},"author":{"name":"Tim Kinnane","email":"tim.kinnane@amazebot.chat"},"license":"MIT","engines":{"node":"> 8.0.0","npm":"> 5.0.0"},"main":"lib/index.js","types":"lib/index.d.ts","bin":{"rocket-call":"lib/cli.js"},"directories":{"lib":"lib"},"keywords":["rocket.chat","chat","chatops","messaging","CUI","typescript","DDP"],"publishConfig":{"access":"public"},"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","add:local":"yarn add --registry http://localhost:4873"},"dependencies":{"@amazebot/config":"^0.1.1","@amazebot/logger":"^0.1.1","@types/ws":"^6.0.1","ws":"^6.1.2"},"gitHead":"682d3d28faefd214cea98c658e8f9ee56d6ac2d7","bugs":{"url":"https://github.com/Amazebot/rocket-control/issues"},"_id":"@amazebot/rocket-socket@0.1.0","_nodeVersion":"11.8.0","_npmVersion":"lerna/3.13.0/node@v11.8.0+x64 (darwin)","_npmUser":{"name":"timkinnane","email":"timkinnane@gmail.com"},"dist":{"integrity":"sha512-sEnNfpQJMiM6/8l5drB3V1DW9V/KWOnq72LBfqXgtgY27jCoDdhg6L3lgy1jrieCHlywqOkdEwnJIJVp95/wiw==","shasum":"4679d713a32deed040d40e35e4da0179a675f401","tarball":"https://registry.npmjs.org/@amazebot/rocket-socket/-/rocket-socket-0.1.0.tgz","fileCount":24,"unpackedSize":43587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcdngTCRA9TVsSAnZWagAALHYQAJ33jvNdAFLUE5dhI1tH\n93Lo6Y3bQmDZEtUUrQ+Zp3eNQ+4r+XW1jU2XjfMzPw5O/bjHN/qp0FOGBy6O\nr7ITyTIy5HEbkEIqgI4ouVAVac39W3/FXf8klagslvbuPDsSCsBP5mrbPuXW\ndfEfj1o+kRoOL9TK49xR/FyJhiIQG7mxzQxyzlyMPpq7PxpXwacbETrDA19w\nEGqjBc23/9vnWGt+gSOmD/uztzOM+Z0ajthhlV1URjzhl2Dv13YG+9GEvJ9g\nnn3E23b1MRRiEY2C18/llWxE2MrWM8NF49+l2PMDPBGFeKKg9pCBEGvXQR8n\nuurgRu3RIASDeEyV4qyHfZOnvfXrOm3uJDoo+Pj6VIIetuHkSYXi1+fUnsnt\njpWboEGbFvIeMFPkDubNvRREnbWLVGpUgrWJb5t31Am5DFhmtbDC7/EtL33P\n637Vrrzhlj1hd4zFXREomv6we+3dz0oNlDHe5YAc8wNILrfOiQ6+a8J7Bq7O\nsv1mmFR8fT87FXmLwC5uRm9Ho2PrxSw9jTbxxr9NfL8EHHbxMXH67xLgf9SG\n7GDg/RjBIPodmDEYz+9RdMZv9CGYtdWoIjFXaDiyMZTMontF9LKkd1XEz37r\nhy6e49++qXVaIviYQTuFKW9h/Qcgp/MehgoC2NIizLvFENGYey4SHP6B+4fa\ncBzH\r\n=mfsR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGe1RSsTUtbFg0kvXwA7K2E7CNzTMzd2C4R0ztUdlYEAIhAK5r9WmvWz41wGI04xXAb6dYJIHCEZh6ZCO79Zu5Y/4H"}]},"maintainers":[{"name":"timkinnane","email":"timkinnane@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rocket-socket_0.1.0_1551267858567_0.33819857090186245"},"_hasShrinkwrap":false},"0.1.1":{"name":"@amazebot/rocket-socket","version":"0.1.1","description":"Communicate with Rocket.Chat Realtime API via websocket (DDP).","homepage":"https://github.com/Amazebot/rocket-control/tree/master/packages/socket","repository":{"type":"git","url":"git+ssh://git@github.com/Amazebot/rocket-control.git"},"author":{"name":"Tim Kinnane","email":"tim.kinnane@amazebot.chat"},"license":"MIT","engines":{"node":"> 8.0.0","npm":"> 5.0.0"},"main":"lib/index.js","types":"lib/index.d.ts","bin":{"rocket-call":"lib/cli.js"},"directories":{"lib":"lib"},"keywords":["rocket.chat","chat","chatops","messaging","CUI","typescript","DDP"],"publishConfig":{"access":"public"},"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","add:local":"yarn add --registry http://localhost:4873"},"dependencies":{"@amazebot/config":"^0.1.1","@amazebot/logger":"^0.1.1","@types/ws":"^6.0.1","ws":"^6.1.2"},"gitHead":"627a1cd05ebd2fa150d24a5914b8de48407214ee","bugs":{"url":"https://github.com/Amazebot/rocket-control/issues"},"_id":"@amazebot/rocket-socket@0.1.1","_nodeVersion":"11.12.0","_npmVersion":"lerna/3.13.0/node@v11.12.0+x64 (darwin)","_npmUser":{"name":"timkinnane","email":"timkinnane@gmail.com"},"dist":{"integrity":"sha512-e8x1yhq7+HoqMxhnItgyEoxT9CoxZPkK02PX/Vh3ndWG6DyUtMRl4ZhmnodOup7mM7N0qxX/Gr7gjfLYgzkZTg==","shasum":"16927fc4bb5e6fdaa5c1f2a16ab814dca6e8d78b","tarball":"https://registry.npmjs.org/@amazebot/rocket-socket/-/rocket-socket-0.1.1.tgz","fileCount":24,"unpackedSize":44869,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcvGnyCRA9TVsSAnZWagAAtWIP/1+R7V7Y5qDOT7e2xCGk\nAvCXwI5zbWS96jU7bbWUqpML3q4hIiDTDvedybJ+86G0LOIrAnm2UU5mjAtS\neivzHcoBU66F+fmAvn3gwRPoWNSXXSLAgY+UviB94Ir9xTWLU9uYV5C+pkSb\n+THoMtav2AkGeqSC422LAEPnWkNESYV77wvXwQz6jf1MPFK324vIk1wR/okf\njF4C7HGSqHnzN0hPQkoXGMrJk4cny1/4dqBH2s7rgmT8Duws94yYpYW3r5jb\noM2Bb5ZMCsf1AHSfcbgwyOtuk6FGlD1OipK4aWBX3jUipR9Cz1aLOe5CDJ+1\nuFw7JSeIsRqdY56TiM2p1S6cLiL+o++mL6PfjGHOnfsfbHGrMPnNC5L447ff\nayiqxQyQ13gzk1D0dbU0LXQ7rnzf/ZDroWaTT9jKc0vemaVto5nu5ItemQCa\n5aWTNutSf8P5wBlHN1gOHiapDvIFFzKvXCllzvhy2lcju5/tdEcOFCFc0wCe\ncQgixv9ySsV8okzXj2qWqu5eoPlhM4N1ewWJeVp/bfL/S2uB7t1Sk8mHpqEg\ngwLgd+CTn3ngMXDyyh3T0WREIR/fXP8MdlD2Y4x+L28kJteYemmp3U2HkSBE\n2TKvg+ic078+EXsqBz3O18WhHwE045H0Gg8l4b0Tp4BSk+CoOCggPSxqzRCV\nJI4a\r\n=DXj8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQX529sRGudcqi7FiLXPXyQiSbFDIOYRTjgMhOgJSr0QIgMu1e3Db6YZVhotX5Fl30BAx7lwnkF6kpBbdJUMC3Xig="}]},"maintainers":[{"name":"timkinnane","email":"timkinnane@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rocket-socket_0.1.1_1555851762139_0.18570572184420486"},"_hasShrinkwrap":false}},"time":{"created":"2018-12-11T12:17:45.499Z","0.0.1":"2018-12-11T12:17:45.790Z","modified":"2022-04-04T13:44:20.977Z","0.1.0":"2019-02-27T11:44:18.687Z","0.1.1":"2019-04-21T13:02:42.268Z"},"maintainers":[{"name":"timkinnane","email":"timkinnane@gmail.com"}],"description":"Communicate with Rocket.Chat Realtime API via websocket (DDP).","homepage":"https://github.com/Amazebot/rocket-control/tree/master/packages/socket","keywords":["rocket.chat","chat","chatops","messaging","CUI","typescript","DDP"],"repository":{"type":"git","url":"git+ssh://git@github.com/Amazebot/rocket-control.git"},"author":{"name":"Tim Kinnane","email":"tim.kinnane@amazebot.chat"},"license":"MIT","readme":"[control]: https://github.com/Amazebot/rocket-control\n[config]: https://github.com/Amazebot/rocket-control#config\n[mentions]: https://github.com/Amazebot/rocket-control/tree/master/packages/examples/src/bot-mentions.ts\n\n# 🔌 Rocket Socket\nCommunicate with Rocket.Chat Realtime API via websocket (DDP).\n\n---\n\n### Usage\n\nSee the main [`rocket-control` README][control] for general configuration.\n\n[This example script][mentions] uses `rocket-socket` and `rocket-sims` to create\na new bot user, connect to the general channel and stream all bot mentions to\nthe console.\n\n#### `new Socket()`\n\nAccepts options object, or uses defaults from environment config. Attributes can\ninclude `host` *string* and `ssl` *boolean*.\n\nCreates a websocket handler instance to manage the connection with Rocket.Chat.\n\n```ts\nimport { Socket } from '@amazebot/rocket-socket'\nconst socket = new Socket()\n```\n\n#### `.open()` and `.close()`\n\nOpens connection with Rocket.Chat. Returns promise.\n\nAccepts option number of ms to attempt re-opening.\n\n```ts\nconst socket = new Socket()\nawait socket.open()\nawait socket.close()\n```\n\n#### `.login(credentials)` and `.logout()`\n\nLogin can be called without explicit `.open()`, it will open the socket to login.\n\nLogin can be called without credentials to use the default user/pass from environment [configs][control].\n\nLogin returns a credential object that can be used to resume login after closing and re-opening socket.\n\nLogin accepts a range of credential objects (including the resume object mentioned above):\n\nUsername/password:\n```ts\n{\n  username: string\n  password: string\n}\n```\n\nServer credentials:\n```ts\n{\n  user: { username: string }\n  password: { digest: string, algorithm: string }\n}\n```\n\nOauth token:\n```ts\n{\n  oauth: {\n    credentialToken: string\n    credentialSecret: string\n  }\n}\n```\n\nResume token:\n```ts\n{\n  resume: string\n}\n```\n\n#### `.connected` and `.loggedIn`\n\nBoolean attributes for confirming connection status.\n\n#### `.subscribe(name, params, callback)`\n\nSubscribe to any stream of events on the server, passing the stream `name` and `params` *array* as per Realtime API docs here: https://rocket.chat/docs/developer-guides/realtime-api/subscriptions/\n\nThe callback function will be called with every emitted event.\n\nSubscribe method returns a subscription object, with the same attributes used to create it, along with an `.id` and `.unsubscribe()` method.\n\n### CLI Usage\n\nMethod calls can also be made over DDP manually through the CLI, using a method\nname and optional other parameters. Results will be printed to console. Requires\nthe same config as above, with username/password as ENV or command line opts.\n\n#### Locally with `ts-node`\n\nRun pre-compiled locally, using\n\n```sh\n> ts-node src/cli --method getServerInfo\n```\n\nOutputs\n\n```sh\n{ result:\n   { version: '0.73.2',\n...\n```\n\nYou can also pass params\n\n```sh\n> ts-node src/cli --method getRoomNameById --params GENERAL\n```\n\nOutputs\n\n```sh\n{ result: 'general' }\n```\n\n#### As a dependency with `rocket-call`\n\nRun the compiled bin when installed as a dependency\n\n```sh\n> node_modules/bin/rocket-call --method getServerInfo\n```\n\nOr use the alias arguments for both method and params\n\n```sh\n> node_modules/bin/rocket-call -m getRoomNameById -p GENERAL\n```\n\nCould work as a global NPM package too.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/Amazebot/rocket-control/issues"}}