How to set "Definition Expression" to a StreamLayer where the data is not coming from an ArcGIS Server Stream?

I try with the following method streamLayer.setDefinitionExpression("field='value'"); but doesn't work.

  • What do you mean with "data is not coming from an AGS Stream"? Where is the data caming from?
    – Katah
    Apr 7, 2017 at 12:52
  • @Katah The data is coming from an Socket, you can define a "socketUrl" (URL used to make the socket connection.)
    – gemr1423
    Apr 7, 2017 at 12:57
  • if you test streamLayer.getDefinitionExpression() after set the Definition expresion, what are you getting? I guess it is only working if the Data is coming from an AGS. If you check the documentation, it says: Gets the where property of the layer's filter. Only relevant when data for the layer is coming from an ArcGIS Server Stream Service.
    – Katah
    Apr 7, 2017 at 14:36

1 Answer 1


When you call streamLayer.setDefinitionExpression("field='value'"); ArcGIS JS API will send a message to the server with the filter {"filter":{"where":"field='value'"}}, this is automatically handled by Stream Services and the next data you receive will be filtered.

If you have a custom server (Web socket Server) you need to receive the filter and apply to the stream you are sending to clients.

  • Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format.
    – Midavalo
    Apr 7, 2017 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.