{"id":41704228,"url":"https://github.com/eclipse-iofog/iofog-nodejs-sdk","last_synced_at":"2026-01-24T21:21:12.290Z","repository":{"id":30898390,"uuid":"126321112","full_name":"eclipse-iofog/iofog-nodejs-sdk","owner":"eclipse-iofog","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-30T14:37:55.000Z","size":502,"stargazers_count":8,"open_issues_count":3,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-09-28T04:52:20.468Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eclipse-iofog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-03-22T10:50:47.000Z","updated_at":"2020-04-30T18:41:16.000Z","dependencies_parsed_at":"2023-07-17T16:19:41.767Z","dependency_job_id":null,"html_url":"https://github.com/eclipse-iofog/iofog-nodejs-sdk","commit_stats":null,"previous_names":["iofog/iofog-nodejs-sdk"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/eclipse-iofog/iofog-nodejs-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-iofog%2Fiofog-nodejs-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-iofog%2Fiofog-nodejs-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-iofog%2Fiofog-nodejs-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-iofog%2Fiofog-nodejs-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eclipse-iofog","download_url":"https://codeload.github.com/eclipse-iofog/iofog-nodejs-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-iofog%2Fiofog-nodejs-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28737112,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T19:23:36.361Z","status":"ssl_error","status_checked_at":"2026-01-24T19:23:28.966Z","response_time":89,"last_error":"SSL_read: 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":[],"created_at":"2026-01-24T21:21:11.467Z","updated_at":"2026-01-24T21:21:12.283Z","avatar_url":"https://github.com/eclipse-iofog.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iofog/nodejs-sdk\n\nThis module lets you easily build a micro-service. It gives you all the functionality to interact with ioFog via Local API. Additionally some useful methods to work with ioMessage.\n\n - send new message to ioFog (sendNewMessage)\n - fetch next unread messages from ioFog (getNextMessages)\n - fetch messages for time period and list of accessible publishers (getMessagesByQuery)\n - get config options (getConfig)\n - create ioMessage JSON object (ioMessage)\n - connect to ioFog Control Channel via WebSocket (wsControlConnection)\n - connect to ioFog Message Channel via WebSocket (wsMessageConnection) and publish new message via this channel (wsSendMessage)\n\n## Code snippets: \n\nimport module:\n```javascript\n  var ioFogClient = require('@iofog/nodejs-sdk');\n```\n\nset up custom host, port and container's ID (in case of no params default values for host and port will be used: 'ioFog', 54321)\nand pass main callback to trigger when ioFogClient initialization is done:\n```javascript\n  ioFogClient.init( 'iofog', 54321, null,\n    function () {\n        // any code to perform after ioFog is initialized\n    }\n  );\n```\n\n#### REST calls\npost new ioMessage to ioFog via REST call:\n```javascript\n  ioFogClient.sendNewMessage(\n    ioFogClient.ioMessage(\n                 {\n                     'tag': 'Bosch Camera 8798797',\n                     'groupid': 'group1',\n                     'sequencenumber': 2,\n                     'sequencetotal': 100,\n                     'priority': 5,\n                     'authid': 'auth',\n                     'authgroup': 'authgrp',\n                     'chainposition': 10,\n                     'hash': 'hashingggg',\n                     'previoushash': 'prevhashingggg',\n                     'nonce': 'nounceee',\n                     'difficultytarget': 30,\n                     'infotype': 'image/jpeg',\n                     'infoformat': 'base64',\n                     'contextdata': 'gghh',\n                     'contentdata' : 'sdkjhwrtiy8wrtgSDFOiuhsrgowh4touwsdhsDFDSKJhsdkljasjklweklfjwhefiauhw98p328'\n                 }),\n    {\n        'onBadRequest':\n            function(errorMsg) {\n                console.log(errorMsg);\n            },\n        'onMessageReceipt':\n            function(messageId, timestamp) {\n                console.log(messageId + ' : ' + timestamp);\n            },\n        'onError':\n            function(error) {\n                console.log(error);\n            }\n    }\n  );\n```\n\nget list of ioMessages by time frame for accessible publishers from ioFog via REST call\n```javascript\n  ioFogClient.getMessagesByQuery( Date.now(), Date.now(), ['PUBLISHER'],\n    {\n        'onBadRequest':\n            function(errorMsg) {\n                console.log(errorMsg);\n            },\n        'onMessagesQuery':\n            function(timeframestart, timeframeend, messages) {\n                console.log(timeframestart + ':' + timeframeend);\n                console.log(messages);\n            },\n        'onError':\n            function(error) {\n                console.log(error);\n            }\n    }\n  );\n```\n\nget list of next unread ioMessages via REST call\n```javascript\n  ioFogClient.getNextMessages(\n    {\n        'onBadRequest':\n            function(errorMsg) {\n                console.log(errorMsg);\n            },\n        'onMessages':\n            function(messages) {\n                console.log(messages);\n            },\n        'onError':\n            function(error) {\n                console.log(error);\n            }\n    }\n  );\n```\n\nget container's config via REST call\n```javascript\n  ioFogClient.getConfig(\n    {\n        'onBadRequest':\n            function(errorMsg) {\n                console.log(errorMsg);\n            },\n        'onNewConfig':\n            function(config) {\n               console.log(config);\n            },\n        'onError':\n            function(error) {\n                console.log(error);\n            }\n    }\n  );\n```\n\n#### WebSocket(WS) calls\nopen WS Message Channel to ioFog with callback that will be executed on open socket (in this example - sends new message via this channel)\n```javascript\n  ioFogClient.wsMessageConnection(\n    function(ioFogClient) {\n        var ioMsg = ioFogClient.ioMessage(\n                 {\n                     'tag': 'Bosch Camera 8798797',\n                     'groupid': 'group1',\n                     'sequencenumber': 2,\n                     'sequencetotal': 100,\n                     'priority': 5,\n                     'authid': 'auth',\n                     'authgroup': 'authgrp',\n                     'chainposition': 10,\n                     'hash': 'hashingggg',\n                     'previoushash': 'prevhashingggg',\n                     'nonce': 'nounceee',\n                     'difficultytarget': 30,\n                     'infotype': 'image/jpeg',\n                     'infoformat': 'base64',\n                     'contextdata': 'gghh',\n                     'contentdata' : 'sdkjhwrtiy8wrtgSDFOiuhsrgowh4touwsdhsDFDSKJhsdkljasjklweklfjwhefiauhw98p328'\n                 });\n        ioFogClient.wsSendMessage(ioMsg);\n    },\n    {\n        'onMessages':\n            function(messages) {\n                console.log(messages);\n            },\n        'onMessageReceipt':\n            function(messageId, timestamp) {\n                console.log(messageId + ' : ' + timestamp);\n            },\n        'onError':\n            function(error) {\n                console.log(error);\n            }\n    }\n  );\n```\n\nOpen WS Control Channel to ioFog\n```javascript\n  ioFogClient.wsControlConnection(\n    {\n        'onNewConfigSignal':\n            function() {\n                console.log('New config is awaiting.');\n            },\n        'onError':\n            function(error) {\n                console.log(error);\n            }\n    }\n  );\n```\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-iofog%2Fiofog-nodejs-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feclipse-iofog%2Fiofog-nodejs-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-iofog%2Fiofog-nodejs-sdk/lists"}