server.on('connect', e => {
console.log(e.detail.queryParams.get('name'))
})
Reason it was like this, is because every client connection could use different params, so we need to set the parameters per connection, meaning we can't just do this.queryParams = url.searchParams because it will be overridden when a new connection comes in
Alternatively, we could add it to the client map:
clients.set(id, {
socket,
queryParams: url.queryParams
})
server.on('check google', e => {
// ok so the client uses query params to check a specific google site, now im finally gonna use it
const client = server.clients.get(e.detail.id)
const site = client.queryParams.get("site")
})
sorry i was super late on this. i would review it then stop, then come back and forget what i reviewed, then stop. finally have some little time to spare.
Reason it was like this, is because every client connection could use different params, so we need to set the parameters per connection, meaning we can't just do
this.queryParams = url.searchParams
because it will be overridden when a new connection comes inAlternatively, we could add it to the client map: