{"_id":"56acef31693f0a0d0085f0ab","__v":4,"parentDoc":null,"version":{"_id":"56acd71213ac890d001c3c7d","project":"56acd71213ac890d001c3c7a","__v":15,"createdAt":"2016-01-30T15:30:26.928Z","releaseDate":"2016-01-30T15:30:26.928Z","categories":["56acd71313ac890d001c3c7e","56acd8f113ac890d001c3c81","56acd8f95ac4060d0027865e","56acd93a13ac890d001c3c82","56ad20660ab3c00d00ce3347","56ad356a2a7860170013f714","56ad47eb0ab3c00d00ce334f","56afd523bc304a0d00ace1df","56b29a019621f20d00efb37e","56b657e11bc6970d009feee7","5845cc3c39950c1b002afe77","5845cde163c11b250037967e","5846efd45d064323007b17b4","588604da4674e32300efd160","588627882393d50f00f1322c"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"56acd8f113ac890d001c3c81","__v":6,"pages":["56acecb32a7860170013f6e9","56acedfed21f1b0d00fd2f70","56aceedb5ac4060d0027866d","56acef31693f0a0d0085f0ab","56acf23d2a7860170013f6f3","56ad4b89c00d120d00744353"],"project":"56acd71213ac890d001c3c7a","version":"56acd71213ac890d001c3c7d","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-30T15:38:25.293Z","from_sync":false,"order":8,"slug":"singularity","title":"Singularity"},"user":"56acd6caa040860d00ac94a2","githubsync":"","project":"56acd71213ac890d001c3c7a","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-30T17:13:21.238Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Did you Register your Application?\",\n  \"body\": \"Before you access Singularity you must first register your application. Check out the \\\"Registering an Application\\\" section of these docs to see how.\"\n}\n[/block]\nAuthentication is handled programmatically as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"socket.emit('authentication', \\n    {\\n        key: \\\"your client ID\\\", \\n        secret: \\\"your client secret\\\",\\n    }\\n);\\n\\n\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe API will respond with the **authenticated** event if your credentials are properly authenticated:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"socket.on('authenticated', function(response) {\\n    //your logic here\\n});\\n\\n//To catch failed client connection attempts.\\nsocketClient.on('unauthorized', function(err){\\n  console.log('Authentication error: ' + err.message);\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe contents of the **response** object on a successful authentication is a JSON object of the following form:\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    result: {\\n      status: 1,\\n      message: \\\"Client authentication successful.\\\"\\n    },\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nOnce your client is connected you can request access to GameWisp Channel data for any channel that has authorized your application and provided your app with an **access_token** .\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"What next?\"\n}\n[/block]\nLearn how to [connect your Singularity app to a GameWisp channel ](https://gamewisp.readme.io/docs/connecting-to-a-gamewisp-channel-on-singularity) and receive data in real-time.","excerpt":"","slug":"connecting-your-client-to-singularity","type":"basic","title":"Connecting your Client"}

Connecting your Client


[block:callout] { "type": "info", "title": "Did you Register your Application?", "body": "Before you access Singularity you must first register your application. Check out the \"Registering an Application\" section of these docs to see how." } [/block] Authentication is handled programmatically as follows: [block:code] { "codes": [ { "code": "socket.emit('authentication', \n {\n key: \"your client ID\", \n secret: \"your client secret\",\n }\n);\n\n", "language": "javascript" } ] } [/block] The API will respond with the **authenticated** event if your credentials are properly authenticated: [block:code] { "codes": [ { "code": "socket.on('authenticated', function(response) {\n //your logic here\n});\n\n//To catch failed client connection attempts.\nsocketClient.on('unauthorized', function(err){\n console.log('Authentication error: ' + err.message);\n});", "language": "javascript" } ] } [/block] The contents of the **response** object on a successful authentication is a JSON object of the following form: [block:code] { "codes": [ { "code": "{\n result: {\n status: 1,\n message: \"Client authentication successful.\"\n },\n}", "language": "json" } ] } [/block] Once your client is connected you can request access to GameWisp Channel data for any channel that has authorized your application and provided your app with an **access_token** . [block:api-header] { "type": "basic", "title": "What next?" } [/block] Learn how to [connect your Singularity app to a GameWisp channel ](https://gamewisp.readme.io/docs/connecting-to-a-gamewisp-channel-on-singularity) and receive data in real-time.