Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: An Endpoint to verify thing channel connection #2304

Open
arvindh123 opened this issue Jun 21, 2024 · 2 comments
Open

Feature: An Endpoint to verify thing channel connection #2304

arvindh123 opened this issue Jun 21, 2024 · 2 comments
Assignees

Comments

@arvindh123
Copy link
Contributor

Is your feature request related to a problem? Please describe.

In Bootstrap, for the request to change the state to 1, we need to send request to things service to connect the thing and channel from bootstrap service using SDK. If the thing and channel are already connected, things service returns an error.

Therefore, we should check if the thing and channel are connected before sending the connect request from Bootstrap.

To check if the thing and channel are connected, the only way we have now is to list the channels to which the thing is connected and then check if the channel ID is present in that list.

Listing is not an efficient process. For example, if the thing has 100 channel connections, we need to retrieve the entire list of 100 channels and then check if the connection requested channel ID is present in that list.

Describe the feature you are requesting, as well as the possible use case(s) for it.

One solution to this problem is implementing a feature, specifically an endpoint in the Things service, to verify if a thing and a channel are connected. This will streamline the process and avoid the inefficiency of listing all channels to which a thing is connected. Here's a detailed outline of this solution:

Endpoint: GET /verify-connection

Request Parameters:

  • thing_id: The ID of the thing.
  • channel_id: The ID of the channel.

Response:

  • 200 OK: If the thing is connected to the channel.
  • 204 No Content or 401 or 403: If the thing is not connected to the channel.

Indicate the importance of this feature to you.

Must-have

Anything else?

No response

@arvindh123
Copy link
Contributor Author

This one is musted need for this ticket #2302

@arvindh123
Copy link
Contributor Author

arvindh123 commented Jul 25, 2024

Example ;

Request : http://localhsot/things/verify-connections
Body :

{ "thing_ids" : ["thing_id_1", "thing_id_2"] , "channel_ids" : [ "channel_id_1" ,"channel_id_2" ] } 

Response :

{
  "status": "all_connected" ,  ## all_disconnected or partially
  "connection_status":  [ 
         {
             "thing_id" : "thing_id_1",
             "channel_id" : "channel_id_1" ,
             "status" : "connected",
         },
          {
             "thing_id" : "thing_id_1",
             "channel_id" : "channel_id_2" ,
             "status" : "disconnected",
         },
          {
             "thing_id" : "thing_id_2",
             "channel_id" : "channel_id_1" ,
             "status" : "disconnected",
         },
          {
             "thing_id" : "thing_id_2",
             "channel_id" : "channel_id_2" ,
             "status" : "connected",
         }
    ] 
}

@arvindh123 arvindh123 moved this from 🚧 In Progress to 🩺 Review and testing in Magistrala Jul 30, 2024
@nyagamunene nyagamunene moved this from 🩺 Review and testing to 🚧 In Progress in Magistrala Aug 5, 2024
@nyagamunene nyagamunene moved this from 🚧 In Progress to 🩺 Review and testing in Magistrala Aug 7, 2024
@arvindh123 arvindh123 moved this from 🩺 Review and testing to 🚀 Ready for merge in Magistrala Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚀 Ready for merge
Development

No branches or pull requests

2 participants