GithubHelp home page GithubHelp logo

Multiple things per WebSocket about api HOT 5 OPEN

webthingsio avatar webthingsio commented on August 19, 2024 3
Multiple things per WebSocket

from api.

Comments (5)

benfrancis avatar benfrancis commented on August 19, 2024 1

Note that the W3C spec already has an id member for a Thing which is a URI identifying the Thing. This can optionally be the URL of the Thing Description.

See also: #29

from api.

benfrancis avatar benfrancis commented on August 19, 2024

I agree it should be possible to have multiple things per WebSocket, as you say we just need to provide a thing ID (URI) in each message to indicate which thing it refers to.

from api.

YonasJ avatar YonasJ commented on August 19, 2024

I would like to bump this idea.

When implementing the API using the arduino API's for the ESP32 I have encountered some challenges:

  • The API's don't really support handling the websockets dynamically. So, it is a fair bit of extra coding to create an end point for each URL.
  • Each websocket uses a fair amount of the precious memory available.
  • I had to do a lot of duplication to support the HTTP and WebSocket API.

I will put some comments in "Implement a single Websocket endpoint for things #947" as well.

from api.

benfrancis avatar benfrancis commented on August 19, 2024

Proposal: Add an id field to WebSocket messages whose value is a URI identifying the thing the message relates to.

{
  "id": "http://mythingserver.com/things/robot1"
  "messageType": "setProperty",
  "data": {
    "leftMotor": 100
  }
}

We also need to figure out how to expose the WebSocket endpoint as currently we do this in the links member of a Thing resource which corresponds to a single Thing.

Perhaps if there is a Gateway capability the Thing Description for the gateway itself can have a top level links member which can link to a WebSocket endpoint for the whole gateway.

from api.

hobinjk avatar hobinjk commented on August 19, 2024

As per the meeting today, this should come with a section or equivalent note that opening a websocket on /things will make a websocket corresponding to multiple things.

This could be considered part of a Gateway capability

from api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.