I've got a simple custom websocket server that adds a user to a specific websocket group during the handshake.
Using a constructor similar to the below:
new StreamLayer({
webSocketUrl: "wss://somewebsocket",
definitionExpression: "test=1",
...
});
even though my server is responding to the handshake with the correct filter, as seen below:
The stream layer is logging the below message:
[esri.layers.graphics.sources.connections.WebSocketConnection]
I debugged the minified WebSocketConnection class and found that the code is doing something like: config.filter === response.filter.
javascript does object comparison by ref, so simply checking if the response object does not equal config object will never succeed.
Hi @Koob,
We added the custom websocket input for StreamLayers really just for simple cases, with GeoEventSource for more fully featured services. Note that as part of mmgeorge/node-stream-service: Example for connection a custom WebSocket stream service to the 4.x Ar..., there's no logic for setting geometryDefinition or definitionExpression specified. We probably need to add to the known limits that this is unsupported for custom websockets (basically undefined behavior currently -- FYI, in some cases filter can actually be a string which is probably why you are seeing that code block not make any sense).
What is your use case here? Are you planning on changing the definitionExpression / geometryDefinition at runtime, and your custom websocket server can handle this?
hi @mgeorge, thanks for the response.
Currently I am using the `definitionExpression` to send the initial filter data to my websocket server to join specific groups.
for example: I have two tenants, tenant 1 and tenant 2.
tenant 1 should not see events for tenant 2.
within my StreamLayer definitionExpression I am setting some filter for example `tenant = tenant1`
this gets sent down to my server during the initial handshake as part of the filter, which I then use to join a azure webpubsub group. which works as expected.
Just thought i'd point out the bug.