Hello, I just started using the js resclient in order to try the websockets but i’m experiencing a problem when i use a query param in my get request, here is my code :
const ResClient = resclient.default;
let client = new ResClient('ws://localhost:8880');
client.get('metering.test?test=test').then(model => {
console.log(model);
model.on('change', () => {
console.log("IT WORKS");
});
}).catch(err => {
console.log(err.message || "Connection error. Are NATS Server and Resgate running?");
});
When I remove the query (?test=test
) it works properly as u can see on the logs :
2021/08/05 12:26:05.674731 [TRC] S=>
event.metering.test.*
2021/08/05 12:26:22.899172 [TRC] =>>
event.metering.test.change: {"values":{"message":"This is a test"}}
2021/08/05 12:26:22.899438 [TRC] [c45thn94t4h32vgpg14g] <<- {"
event
":"metering.test.change","data":{"values":{"message":"This is a test"}}}
But when I use a query param, even thought the subscribed event is the exact same, the changes doesnt get caught and sent back (the get part works well) :
2021/08/05 12:26:51.073876 [TRC] U=>
event.metering.test.*
<------- Refreshing the web page
2021/08/05 12:26:56.493280 [TRC] S=>
event.metering.test.*
2021/08/05 12:27:12.294833 [TRC] =>>
event.metering.test.change: {"values":{"message":"This is a test"}}
Am I missing / misunderstanding something about resgate or the websockets ? I have been trying multiple workarounds and searching for the last couple days but i can’t find any solution to my problem .
Thank you for this amazing project, I hope we can find a fix to my case !
Let me know if you need extra details,
Baptiste