%ToJSON not detecting open websocket as current device
Hello,
I am trying to use the %ToJSON method on my dynamic object, calling it with a "DO" and not passing in outstrm parameter.
We are trying to avoid MAXSTRING errors that we get with some of our abnormally large messages. In order to do this, I am trying to update my code to not call the socket's "Write" method after converting the dynamic object to a JSON string using the %ToString method's output. Per the documentation on the %ToJSON method:
If outstrm is not specified and the method is called via DO, the JSON string is written to the current output device
The previous code (extending from %CSP.WebSocket of course) was doing this:
Method Send(message As %Library.DynamicObject) As %Integer
{
quit 1
}
The updated method is doing this:
{
do message.Msg.%ToJSON()
quit 1
}
When I execute the new code it does not write the JSON object directly to the websocket. It is as if the function does not see the websocket as being the current device.
Any suggestions would be greatly appreciated.