Kudos for pasting this in the forum!
Re specs, they don’t exist yet anywhere. There are some conventions though, namely:
- chat rooms are defined by
streamId
. Essentially all streams are each one “channel” you can subscribe to.
- broadcasting: you’ll see this function pop up in SpeckleCore client. It sends a message to all ws clients listening to that channel.
- direct message: sends a direct message to ws client. you need to have its id to do so though.
As an example, when you unfold the controllers in pane in the viewer, the client broadcasts a ws message in that streamId channel asking for controllers. The first client to respond will then subsequently be sent compute-request
direct messages, to which, in theory, he replies with another direct message (to the viewer) with a compute-request-result
direct message.
In your case, suffice to say if you update an object:
- this means its hash changes (which the server doesn’t take care of when PUT/PATCHing, hash generation so far is up to the clients & their converters),
- therefore needs to get saved again in the database & gets a new _id (everything though should be hash based, and hashes should be server generated ideally to ensure consistency, but that’s for 2.x.x).
- therefore the stream
objects
array changes to include the new object _id.
- the viewer (i assume the online viewer, but the receiver clients do the same actually) then does a diff on the stream object array and loads/unloads the objects that changed.
Honestly, so far, we’ve never had to deal with object modification/generation outside a client where you control the hashing of said object too; hence why PUT & PATCH don’t regenerate the hash, as it’s assumed the client has done it.
In your specific case, a temporary & more efficient solution might be to broadcast an object-changed
event with the object’s db id in it, and then implement that in the viewer: listen for it and just reload that object, not the whole stream. Contrary to my slack answer, you can get away with this even if you change or not the object’s hash.