Hi,
I'm experiencing some problems with the ArcGIS JS SDK's StreamLayer.
It seems that an initial call to sendMessageToClient() is not being considered.
If I change the timeout in https://codepen.io/Kiachma/pen/ZEqgOVQ?editors=1111 to something less than 2000 as it is now, then the example doesn't work. Is this a bug or do I need to add some checks before I call sendMessageToClient? I assumed that I could call sendMessageToClient without a timeout.
The example is based on https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#clientsid...
Solved! Go to Solution.
Hi there,
We addressed this behavior and now you do not need to wait for the layerView.updating becomes false for the first time. You can test the new behavior against our next version.
Here is a codepen showing the fix: https://codepen.io/U_B_U/pen/NWmMRZa?editors=1001
Hi there,
So I looked at the behavior more. We will update the sample.
In any case, the first call to sendMessageToClient() should be when the StreamLayerView is fully loaded and ready. I updated your codepen to show the correct workflow: https://codepen.io/U_B_U/pen/NWmMRZa?editors=1001 the main change being what is shown below.
view.whenLayerView(layer).then( async (layerView) =>{
await reactiveUtils.whenOnce(() => !layerView.updating);
layerView.on("message-received", (event) =>{
console.log("message-received event", event);
});
layer.sendMessageToClient({YOUR MESSAGE});
});
Hi there,
We addressed this behavior and now you do not need to wait for the layerView.updating becomes false for the first time. You can test the new behavior against our next version.
Here is a codepen showing the fix: https://codepen.io/U_B_U/pen/NWmMRZa?editors=1001