diff --git a/lib/client.ts b/lib/client.ts index c248ca4..b205f3b 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -150,9 +150,9 @@ export const NotificationAPIClientSDK: NotificationAPIClientSDK = { websocket: { object: undefined, connect: function () { - let address = `wss://${NotificationAPIClientSDK.config.websocketHost}?userId=${NotificationAPIClientSDK.config.userId}&envId=${NotificationAPIClientSDK.config.clientId}`; + let address = `wss://${NotificationAPIClientSDK.config.websocketHost}?userId=${encodeURIComponent(NotificationAPIClientSDK.config.userId)}&envId=${NotificationAPIClientSDK.config.clientId}`; if (NotificationAPIClientSDK.config.hashedUserId) { - address += `&userIdHash=${NotificationAPIClientSDK.config.hashedUserId}`; + address += `&userIdHash=${encodeURIComponent(NotificationAPIClientSDK.config.hashedUserId)}`; } NotificationAPIClientSDK.websocket.object = new WebSocket(address); NotificationAPIClientSDK.websocket.object.onmessage = (m) => { diff --git a/package.json b/package.json index 9f3f423..ee73d53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@notificationapi/core", - "version": "0.0.7", + "version": "0.0.8", "type": "module", "main": "dist/main.js", "types": "dist/main.d.ts",