Hi,
I am trying to setup a StreamLayer with a custom WebSocket url, using Azure WebPubSub.
using the simple constructor as seen below:
const streamLayer = new StreamLayer({
popupTemplate: {
content: "OBJECTID={OBJECTID}, TRACKID={TRACKID}",
},
webSocketUrl: "wss://stream-layer.webpubsub.azure.com/client/hubs/SomeHub?access_token=xxx",
objectIdField: "OBJECTID",
fields: [
{
name: "OBJECTID",
alias: "ObjectId",
type: "oid",
},
{
name: "TRACKID",
alias: "TrackId",
type: "oid",
},
],
timeInfo: {
trackIdField: "TRACKID",
},
geometryType: "point",
maxReconnectionAttempts: 100,
maxReconnectionInterval: 10,
renderer: {
type: "simple",
symbol: {
type: "simple-marker",
size: "8px",
color: "gray",
},
},
});
map.add(streamLayer);
Azure WebPubSub requires an access token to be added as a query string to the end of the websocket url.
wss://stream-layer.webpubsub.azure.com/client/hubs/SomeHub?access_token=xxx
For some reason when trying use the websocket url on StreamLayer, it seems to remove the query string from the end of the websocket url?
So you end up with: wss://stream-layer.webpubsub.azure.com/client/hubs/SomeHub
Solved! Go to Solution.
okay, found the answer:
needed to add custom parameters
customParameters: {
access_token: "token"
}
okay, found the answer:
needed to add custom parameters
customParameters: {
access_token: "token"
}
Are you implementing your own websocket server because you are also finding that GeoEvent is not able to handle properly websockets using stream layers with real world rates of events per second? - like from 20-40 events per second) like in our case.