{"__v":109,"_id":"55f0c1bef3735d0d0069208a","category":{"__v":11,"_id":"55f0bd67d5d8fc0d00ca6f44","pages":["55f0c1bef3735d0d0069208a","55f0c39e78661c170035e144","5601e1121ba3720d00a6b93e","5601e11b96e0f70d0044b138","563d419a31f7580d00511e55","563d42098894d20d00014f69","563d422777681a0d00d969b3","563d42640bc2b80d00f30fac","56bad4b84aa5930d00da780c","56bad636f60d630d006885bf","56d0cf4c167e1e1b00807ab6"],"project":"55f0757d4624ec2d00814345","version":"55f0b2b5f3735d0d00691ffe","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-09T23:14:47.564Z","from_sync":false,"order":2,"slug":"web-sdk","title":"JS SDK"},"parentDoc":null,"project":"55f0757d4624ec2d00814345","user":"55f0756a1e63fc37004b8d2b","version":{"__v":9,"_id":"55f0b2b5f3735d0d00691ffe","project":"55f0757d4624ec2d00814345","createdAt":"2015-09-09T22:29:09.118Z","releaseDate":"2015-09-09T22:29:09.118Z","categories":["55f0b2b5f3735d0d00691fff","55f0b2b5f3735d0d00692000","55f0b2b5f3735d0d00692001","55f0bd67d5d8fc0d00ca6f44","55f0cde9d5d8fc0d00ca6f55","563a8a62a8ba320d00106830","563a8ac9a8ba320d00106832","563d410f31f7580d00511e53","563d411de79f670d00a10a5f","563d412a31f7580d00511e54","566a206f74d574170070b640"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-09T23:33:18.414Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"The TigerConnect JS SDK provides a simple way to enhance your web applications with secure messaging.  This quick start guide will help you get the SDK added to your project.  \n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"JS SDK Example\",\n  \"body\": \"We put together a <a href=\\\"https://github.com/tigerconnect/js-sdk-release/tree/master/examples\\\" target=\\\"_blank\\\">JS SDK example</a> to help you get up to speed on how the JS SDK works.  This example demonstrates how to install, instantiate a TigerConnect client, log in, connect to the event stream and send a message.\\n\\nCheck it out here:\\n<a href=\\\"https://github.com/tigerconnect/js-sdk-release/tree/master/examples\\\" target=\\\"_blank\\\">https://github.com/tigerconnect/js-sdk-release/blob/master/examples</a>\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Installation\"\n}\n[/block]\nThe SDK supports both web and node.js. \n\n##Web\n\n###Using [Bower](http://bower.io/)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"bower install --save tigerconnect\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script src=\\\"bower_components/tigerconnect/tigerconnect-sdk-web.min.js\\\"></script>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n###Manual Include\n\nDownload the [tigerconnect-sdk-web.min.js](https://raw.githubusercontent.com/tigerconnect/js-sdk-release/master/tigerconnect-sdk-web.min.js) and include it in a script tag:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script src=\\\"path/to/tigerconnect-sdk-web.min.js\\\"></script>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n##Node\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"npm install --save tigerconnect\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var TigerConnect = require('tigerconnect')\\nvar client = new TigerConnect.Client(config)\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Initialization\"\n}\n[/block]\nAll communication with TigerConnect is performed with a single `TigerConnect.Client ` instnace. The client can hold a single authenticated user, and will execute all commands on this user's behalf.\n\nCreate a client:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var client = new TigerConnect.Client()\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Quick Example\"\n}\n[/block]\nThis example shows how to initialize a client, sign in, listen to new messages and send a message:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var client = new TigerConnect.Client({ defaultOrganizationId: 'some-org-id' })\\n\\nclient.signIn('user:::at:::mail.com', 's3cr3t', { udid: 'unique-device-id' }).then(function (session) {\\n  onSignedIn(session)\\n})\\n\\nfunction onSignedIn(session) {\\n  console.log('Signed in as', session.user.displayName)\\n  \\n  client.messages.sendToUser(\\n    'someone@mail.com',\\n    'hello!'\\n  ).then(function (message) {\\n    console.log('sent', message.body, 'to', message.recipient.displayName)\\n  })\\n\\n  client.events.connect()\\n  \\n  client.on('message', function (message) {\\n    console.log(\\n      'message event',\\n      message.sender.displayName,\\n      'to',\\n      message.recipient.displayName,\\n      ':',\\n      message.body\\n    )\\n  })\\n}\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nSee full code example in <a href=\"https://github.com/tigerconnect/js-sdk-release/tree/master/examples\" target=\"_blank\">the examples folder on GitHub</a>.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"In-Depth API Reference\"\n}\n[/block]\nTo learn more about the SDK usage with code snippets, go to our <a href=\"https://github.com/tigerconnect/js-sdk-release\" target=\"_blank\">**Full JS SDK API Reference on GitHub**</a>\n\nThe full reference shows all functionality and principles in the SDK, such as:\n\n* Authentication\n* Group management; create groups, add/remove members\n* Sending a message to a group\n* Search\n* Metadata on entities\n* List of all models and properties\n* Finding entities in the store or the server","excerpt":"A quick guide to the TigerConnect JS SDK.","slug":"javascript-quick-start","type":"basic","title":"Quick Start Guide"}

Quick Start Guide

A quick guide to the TigerConnect JS SDK.

The TigerConnect JS SDK provides a simple way to enhance your web applications with secure messaging. This quick start guide will help you get the SDK added to your project. [block:callout] { "type": "info", "title": "JS SDK Example", "body": "We put together a <a href=\"https://github.com/tigerconnect/js-sdk-release/tree/master/examples\" target=\"_blank\">JS SDK example</a> to help you get up to speed on how the JS SDK works. This example demonstrates how to install, instantiate a TigerConnect client, log in, connect to the event stream and send a message.\n\nCheck it out here:\n<a href=\"https://github.com/tigerconnect/js-sdk-release/tree/master/examples\" target=\"_blank\">https://github.com/tigerconnect/js-sdk-release/blob/master/examples</a>" } [/block] [block:api-header] { "type": "basic", "title": "Installation" } [/block] The SDK supports both web and node.js. ##Web ###Using [Bower](http://bower.io/) [block:code] { "codes": [ { "code": "bower install --save tigerconnect", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "<script src=\"bower_components/tigerconnect/tigerconnect-sdk-web.min.js\"></script>", "language": "javascript" } ] } [/block] ###Manual Include Download the [tigerconnect-sdk-web.min.js](https://raw.githubusercontent.com/tigerconnect/js-sdk-release/master/tigerconnect-sdk-web.min.js) and include it in a script tag: [block:code] { "codes": [ { "code": "<script src=\"path/to/tigerconnect-sdk-web.min.js\"></script>", "language": "javascript" } ] } [/block] ##Node [block:code] { "codes": [ { "code": "npm install --save tigerconnect", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "var TigerConnect = require('tigerconnect')\nvar client = new TigerConnect.Client(config)", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Initialization" } [/block] All communication with TigerConnect is performed with a single `TigerConnect.Client ` instnace. The client can hold a single authenticated user, and will execute all commands on this user's behalf. Create a client: [block:code] { "codes": [ { "code": "var client = new TigerConnect.Client()", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Quick Example" } [/block] This example shows how to initialize a client, sign in, listen to new messages and send a message: [block:code] { "codes": [ { "code": "var client = new TigerConnect.Client({ defaultOrganizationId: 'some-org-id' })\n\nclient.signIn('user@mail.com', 's3cr3t', { udid: 'unique-device-id' }).then(function (session) {\n onSignedIn(session)\n})\n\nfunction onSignedIn(session) {\n console.log('Signed in as', session.user.displayName)\n \n client.messages.sendToUser(\n 'someone@mail.com',\n 'hello!'\n ).then(function (message) {\n console.log('sent', message.body, 'to', message.recipient.displayName)\n })\n\n client.events.connect()\n \n client.on('message', function (message) {\n console.log(\n 'message event',\n message.sender.displayName,\n 'to',\n message.recipient.displayName,\n ':',\n message.body\n )\n })\n}", "language": "javascript" } ] } [/block] See full code example in <a href="https://github.com/tigerconnect/js-sdk-release/tree/master/examples" target="_blank">the examples folder on GitHub</a>. [block:api-header] { "type": "basic", "title": "In-Depth API Reference" } [/block] To learn more about the SDK usage with code snippets, go to our <a href="https://github.com/tigerconnect/js-sdk-release" target="_blank">**Full JS SDK API Reference on GitHub**</a> The full reference shows all functionality and principles in the SDK, such as: * Authentication * Group management; create groups, add/remove members * Sending a message to a group * Search * Metadata on entities * List of all models and properties * Finding entities in the store or the server