Hello,
I am currently working on a project that involves creating a new StreamLayer and adding custom parameters such as an API token.
However, I am encountering an issue where the server sometimes fails and there is an automatic reconnection trial.
The problem is that the custom parameters I have set are changing and the reconnection is not working because a new set of custom parameters needs to be added.
I have been trying to update the custom parameters on the object once they change, but it is not affecting the URL that has already been saved.
Is there any way to apply the changes to the constructed StreamLayer, so that the reconnection will work with the updated custom parameters?
I appreciate your help.
Hi there,
I am able to reproduce the issue you are describing. We will look into this issue and will let you know as soon as we have a fix. I cannot think of any workaround at this time but will let you know if others can come up with any.
Thank you for reporting this issue,
-Undral
Hi there,
I meant to ask you try the following days ago. Can you watch the connections status on the layer view and set the custom parameters when the connection status becomes disconnected?
layerView.watch("connectionStatus", function(value) {
console.log("connectionStatus", value)
if (value === "disconnected") {
layer.customParameters = {
token: "secret"
};
}
});
Thanks, @UndralBatsukh, But this is not working, It does recognize the disconnection But doesn't change the token.
Also, Meanwhile, I'm thinking of the whole idea of creating a StreamLayer, As sometimes I need to dynamically update a graphic icon for example, And I don't see there is a way to update the layer like we can do in a FeatureLayer for example (no applyEdits method exist).
Am I wrong? Is there any other method?
Thanks.
Hi there,
We are making some significant updates for StreamLayer at 4.26 and sounds like you can take advantage of these updates. Please check out our changelog for the next version of the api: https://github.com/Esri/feedback-js-api-next/blob/main/CHANGELOG.md
I will let you know once we fix the issue with customParameters which should be version 4.26.
Hi there,
We fixed the issue with customParameters at version 4.26. You will be able to test the fix on our next version next Tuesday.