Nested values returned as "[Data]" in websocket

Hello community !

When getting a resource with nested values from the websocket interface, these nested values are not returned but replaced by the string "[Data]".

Example…

{
	"id": 141,
	"result": {
		"models": {
			"crm.guests.d1510cbd-9b4b-46de-8f63-e9aa1308ab3b": {
				"createdAt": "2022-03-09T20:33:54.000000Z",
				"entityId": "74e08031-cb2e-4531-8194-f719b181953c",
				"firstname": "John",
				"lastname": "Doe",
				"addresses": "[Data]",
				"nationalities": "[Data]",
			}
		}
	}
}

…where as the same call to the REST API will return the nested data.

I am wondering if I did my connection and/or request message the correct way, or if the is the expected behavior. In the later case, I guess that I have to reorganise my resources to have “sub” resources to represent the nested objects as flat resources.

Many thanks for your help.

Lionel

Hi Lionel!

That "[Data]" string is a placeholder value that Resgate returns instead of the proper data value for WebSocket clients that does not support RES client protocol >= v1.2.1, the version that introduced data values. This behavior is to prevent Resgate to crash older WebSocket clients.

The client’s supported version is determined by the version request, which the client should send as the first request after connection. So, my guess is that this request is either missing or faulty.

Are you writing your own WebSocket client? In that case, cool! :smiley:

/Samuel

1 Like

Oh great ! Thanks a lot !
I overlooked this information in the documentation…

Yes I am writing a PHP client for our legacy to be able to call the new services we’re building with Resgate. I find it more sexy to do it with websockets than REST calls even for machine to machine calls :wink:

Lionel