{"id":15656886,"url":"https://github.com/raptorbox/raptorjs","last_synced_at":"2026-02-07T17:31:28.844Z","repository":{"id":44994101,"uuid":"59762838","full_name":"raptorbox/raptorjs","owner":"raptorbox","description":"Raptor IoT platform javascript SDK","archived":false,"fork":false,"pushed_at":"2022-12-06T16:03:37.000Z","size":1363,"stargazers_count":1,"open_issues_count":18,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-19T22:49:00.106Z","etag":null,"topics":["iot","javascript","mqtt","raptor","realtime-updates","sdk"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raptorbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-26T15:44:41.000Z","updated_at":"2020-04-22T16:22:54.000Z","dependencies_parsed_at":"2023-01-24T02:46:23.553Z","dependency_job_id":null,"html_url":"https://github.com/raptorbox/raptorjs","commit_stats":null,"previous_names":[],"tags_count":88,"template":false,"template_full_name":null,"purl":"pkg:github/raptorbox/raptorjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raptorbox%2Fraptorjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raptorbox%2Fraptorjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raptorbox%2Fraptorjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raptorbox%2Fraptorjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raptorbox","download_url":"https://codeload.github.com/raptorbox/raptorjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raptorbox%2Fraptorjs/sbom","scorecard":{"id":762178,"data":{"date":"2025-08-11","repo":{"name":"github.com/raptorbox/raptorjs","commit":"ee578b011b37b27178d5b8c77fd35e1e1dd093b9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"91 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-rq8g-5pc5-wrhr","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-4hpf-3wq7-5rpr","Warn: Project is vulnerable to: GHSA-f522-ffg8-j8r6","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-xf5p-87ch-gxw2","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-wv67-9jq7-8r69","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-7xcx-6wjh-7xp2","Warn: Project is vulnerable to: GHSA-mxhp-79qh-mcx6","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T23:45:09.901Z","repository_id":44994101,"created_at":"2025-08-22T23:45:09.901Z","updated_at":"2025-08-22T23:45:09.901Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29201082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T16:28:23.579Z","status":"ssl_error","status_checked_at":"2026-02-07T16:28:22.566Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iot","javascript","mqtt","raptor","realtime-updates","sdk"],"created_at":"2024-10-03T13:04:41.101Z","updated_at":"2026-02-07T17:31:28.827Z","avatar_url":"https://github.com/raptorbox.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raptor javascript SDK\n\n![Build status](https://travis-ci.org/raptorbox/raptorjs.svg) ![npm release](https://badge.fury.io/js/raptor-sdk.svg) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\n\nRaptor IoT platform javascript SDK\n\n# Topics\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n\n  - [Node.js](#nodejs)\n  - [Browser](#browser)\n\n- [Library configuration](#library-configuration)\n\n- [Example usage](#example-usage)\n\n  - [List all devices](#list-all-devices)\n  - [Search for devices](#search-for-devices)\n  - [Create a device](#create-a-device)\n  - [Load a device definition](#load-a-device-definition)\n  - [Sending data update](#sending-data-update)\n  - [Load a device by ID](#loading-a-device-by-id)\n  - [Retrieving data](#retrieving-data)\n  - [Search for data](#search-for-data)\n\n    - [Numeric range](#numeric-range)\n    - [Time range](#time-range)\n    - [Match](#match)\n    - [Bounding box](#bounding-box)\n    - [Distance](#distance)\n    - [Combining searches](#combining-searches)\n\n- [Getting realtime updates](#getting-realtime-updates)\n\n  - [Connecting to the broker](#connecting-to-the-broker)\n  - [Listening for updates to a stream](#listening-for-updates-to-a-stream)\n  - [Listening for all the updates](#listening-for-all-the-updates)\n\n- [Actuations](#actuations)\n\n  - [Invoking an actuation](#invoking-an-actuation)\n  - [Listening for actuations](#listening-for-actuations)\n\n- [Additional notes](#additional-notes)\n\n- [Tests](#tests)\n\n- [Contributing](#contributing)\n\n- [Docs](#docs)\n\n- [License](#license)\n- [Changelog](#Changelog)\n\n--------------------------------------------------------------------------------\n\n# Introduction\n\nRaptor.js exposes the feature from the [Raptor](http://github.com/raptorbox/raptor) platform as a convenient javascript API.\n\nThis branch is pair with the Raptor API `v4.x`\n\n# Installation\n\n## Node.js\n\nInstall the module from the git repository\n\n```sh\nnpm i raptorbox/raptorjs\n```\n\n\nand then import it in your code\n\n```javascript\nconst Raptor = require('raptor')\n```\n\n## Browser\n\nTo generate a build use `webpack` inside the repository directory. A generated build is made available under [dist](./dist/) for stable releases.\n\n# Library configuration\n\nThe minimum configuration required is the token to access the API.\n\n```javascript\nconst raptor = new Raptor('your api key 1');\n```\n\nLogin with user and password (will fetch a session apiKey automatically). An additional `url` can be provided to use a personalized endpoint\n\n```javascript\nconst raptor = new Raptor({\n  username: \"admin\",\n  password: \"admin\",\n  url: \"http://raptor.local\",\n});\n```\n\n# Example usage\n\n## List all devices\n\n```javascript\nraptor.Inventory().list()\n    .then((pager) =\u003e console.info(\"List loaded, %s elements\", pager.getTotalElements()))\n    .catch((e)   =\u003e console.warn(\"An error occured! %j\", e))\n```\n\nDelete an device with\n\n```javascript\nraptor.Inventory().delete(deviceId)\n```\n\nDelete all the devices instances with\n\n```javascript\nraptor.Inventory().list()\n    .then((pager) =\u003e {\n        pager.getContent().each((d) =\u003e raptor.Inventory().delete(d))\n        console.log(\"All clear\")\n    })\n```\n\n## Search for devices\n\nTo perform a search at least one option is required, multiple option will be AND-ed together\n\n-   Field `id`, `name`, `description` supports text-based queries, with those optional params\n    ```javascript\n    {\n        // one of those values\n        in: [ \"value1\", \"value2\" ],\n        // contains string\n        contains: \"some string\",\n        // exactly match the string\n        match: \"exact match\"\n    }\n    ```\n\n-   Field `properties` supports object-based queries, with those optional params\n    ```javascript\n    {\n        // has a key\n        containsKey: \"my_key\",\n        // has a value\n        containsValue: 1001,\n        // contains those key-values\n        has: {\n            field1: true,\n            field2: 1001\n        }\n    }\n    ```\n\n```javascript\nvar params = {\n    // short format for contains\n    id: \"1111-3333-4444-5555\",\n    name: {\n        in: [\"My device\", \"quadcopter_1\"]\n    }\n    description: {\n        contains: \"example\"\n    },\n    // short format for has: {...}\n    properties: {\n        model: \"a4b2788\"\n    }\n}\n\n// paging support\nvar limit = 1000, // get 1000 results\n    offset = 10; // starting from record 10\n\nraptor.Inventory().search(params, limit, offset)\n    .then((list) =\u003e console.log(\"Found %s\", list.size()))\n```\n\n## Create a device\n\n```javascript\nvar definition = {\n   \"name\": \"Robot\",\n   \"description\": \"My device\",\n   \"streams\": {\n        \"sensing\": {\n          \"light\":    \"number\",\n          \"alarm\":    \"boolean\"\n          \"message\":  \"string\"\n        }\n    },\n    \"actions\": [ \"take-photo\", \"beep\" ],\n    \"properties\": {\n        \"model\": 'robot-001',\n        \"colors\": ['red', 'blue']\n    }    \n}\n```\n\nCreate the device in Raptor\n\n```javascript\nraptor.Inventory().create(definition)\n    .then((device) =\u003e {\n        // device is the new device create\n        console.info(\"Drone device created, id\" + device.id);\n        console.info(device.toJSON());\n        // see below how to use the device to send and receive data\n    })\n    .catch((e) =\u003e {\n        console.warn(\"An error occured!\");\n        return Promise.reject(e);\n    });\n```\n\n## Sending data update\n\nFirst you have to select the stream you want to use, `sensing` in our case, and send the data with the `push` method.\n\n```javascript\n\nconst record = device.getStream('sensing').createRecord({\n    light: 90,\n    alarm: true,\n    message: \"good morning\",\n})\n\nraptor.Stream().push(record)\n\n```\n\nTo store a searchable location in the stream use the special `location` field. The `timestamp` field allow to specify the date/time of the record\n\n```javascript\n\nconst record = device.getStream('sensing').createRecord({\n    timestamp: 2037304801,\n    location: {\n        latitude: 11.234,\n        longitude: 45.432\n    }\n    channels: {\n        light: 42,\n        alarm: false,\n        message: \"ok\",\n    }\n})\n\nraptor.Stream().push(record)\n\n```\n\n## Loading a device by ID\n\nLet's load an instance of a Drone from it's definition\n\n```javascript\n\nlet deviceId = \"the device id\";\n\nraptor.Inventory().read(deviceId)\n    .then((device) =\u003e console.info(\"Device loaded, id %s: \\n%s\",\n        device.id,\n        device.toJSON()\n    ))\n\n```\n\n## Retrieving data from a device\n\nThe returned value is an array of records from the device\n\n```javascript\n\n// paging support\nvar offset = 0,\n    limit = 500\n\nraptor.Stream().pull(device.getStrem(\"sensing\"), offset, limit)\n      .then((result) =\u003e console.log(\"Data size %s == %s\", result.length, limit));\n```\n\n## Search for data in a Stream\n\nMethods to search for data in a stream\n\nAvailable search types are\n\n- [Numeric range](#numeric-range)\n- [Time range](#time-range)\n- [Match](#match)\n- [Bounding box](#bounding-box)\n- [Distance](#distance)\n\n### Numeric Range\n\nSearch for data in a stream matching a numeric range constrain\n\n```javascript\nraptor.Stream().search(device.getStream('sensing'), {\n    channels: {\n        // search for light threshold between 30, 100\n        light: [30, 100]\n    }\n})\n```\n\n### Time Range\n\nSearch for data in a time range, creation date (`lastUpdate`) value will be used to match the search\n\n```javascript\n\nconst to    = Math.floor((new Date).getTime() / 1000), // now, in UNIX seconds\n      from  =  to - (60*60*24), // -1 day\n\nraptor.Stream().search(device.getStream('sensing'), {\n    timestamp: {\n        between: [ from, to ]\n    }\n})\n```\n\n### Match\n\nSearch for a matching value in a provided channel\n\n```javascript\nraptor.Stream().search(device.getStream('sensing'), {\n    channels: {\n        message: {\n            match: \"warning\"\n        }\n    }\n})\n```\n\n### Bounding box\n\nSearch by a delimiting [bounding box](http://en.wikipedia.org/wiki/Minimum_bounding_box)\n\nThis search type will look to match a channel named `location` with a geojson value. [See API docs](http://docs.servioticypublic.apiary.io/#dataqueries)\n\n```javascript\nraptor.Stream().search(device.getStream('sensing'), {\n    location: {\n        boundingBox: {\n            northWest: {\n                latitude: 11.123\n                longitude: 45.321\n            },\n            southWest: {\n                latitude: 12.123\n                longitude: 46.321\n            }\n        }\n    }\n})\n```\n\n### Distance\n\nSearch data by distance\n\n```javascript\nraptor.Stream().search(device.getStream('sensing'), {\n    location: {\n        distance: {\n            center: {\n                latitude: 11.123,\n                longitude: 45.321\n            },\n            radius: 100,\n            unit: \"km\"\n        }\n    }\n})\n```\n\n### Combining searches\n\nTo combine multiple filters\n\n_Notice_ that `distance` is incompatible with `bbox`, if both provided `bbox` will be used\n\n```javascript\nraptor.Stream().search(device.getStream('sensing'), {\n    location: {\n        distance: {\n            center: {\n                latitude: 11.123,\n                longitude: 45.321\n            },\n            radius: 100,\n            unit: \"km\"\n        }\n    }\n    channels: {\n        // search for light threshold between 30, 100\n        light: [30, 100],\n        // and with alarm to true\n        alarm: true,\n        // and message matching \"warning\"\n        message: {\n            match: \"warning\"\n        }\n    }\n})\n```\n\n# Getting realtime updates\n\nUpdates are delivered over MQTT subscriptions\n\n## Connecting to the broker\n\nConnection can be done by providing the `username` and `password` or with an empty `username` and a valid apiKey as the `password`.\n\nThose configuration are automatically taken from the configuration object provided by the library\n\n## Listening for updates to a stream\n\nGet realtime updates from data streams\n\n```javascript\ndevice.Stream().subscribe(device.getStream(\"sensing\"), (data) =\u003e {\n    console.log(\"Stream updated!\");\n    console.log(data);\n})\n```\n\nTo stop listening\n\n```javascript\ndevice.Stream().unsubscribe(device.getStream(\"sensing\"))\n```\n\n## Listening for events\n\nIn some case could be useful to receive all the notifications available, to do so use listen to the `data` event on the device\n\n```javascript\ndevice.Inventory().subscribe(device, (data) =\u003e {\n    console.log(\"Stream updated!\");\n    console.log(data);\n})\n```\n\nUnregister from events subscription with\n\n```javascript\ndevice.Inventory().unubscribe(device)\n```\n\n# Actions\n\nActions allow to invoke virtual operations on an device.\n\n## Invoking an actuation\n\nTo invoke an actuation use the `invoke` method and provide additional parameters as argument\n\nNote that the argument passed to `invoke` **must** be a string, so to send JSON take care of serializing it accordingly\n\n```javascript\nvar status = JSON.stringify({ exposure: 'high', blur: 0.2 }); // must be a string!\nraptor.Action().invoke(device.getAction('take-photo'), status)\n```\n\n## Listening for actions\n\nOn the device side you can listen for specific actions and implement actuations on their arrival.\n\n```javascript\nraptor.Action().subscribe(device.getAction(\"take-photo\"), (id, raw) =\u003e {\n    // parse content\n    var params = JSON.parse(raw)\n    console.log(\"[id: %s] Take a photo with exposure: %j and blur: %s\", id, params.exposure, params.blur);\n    // camera.takePhoto(params)\n})\n```\n\n# Contributing\n\nFeel free to open an issue or contact us to discuss the library status and future development.\n\n## Adding a release\n\nCurrently we use `standard-version` to tag version\n\n - `npm run release` for a minor relase\n - `npm run release-major` for a major relase\n\n# Docs\n\nAPI docs can be generated using `jsdoc`\n\n`./node_modules/jsdoc/jsdoc.js ./ -c ./jsdoc.json -l -r`\n\n# License\n\nApache2\n\n```\nCopyright FBK/CREATE-NET\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraptorbox%2Fraptorjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraptorbox%2Fraptorjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraptorbox%2Fraptorjs/lists"}