Skip to content

Commit

Permalink
encode user id and hash
Browse files Browse the repository at this point in the history
  • Loading branch information
mbasadi committed Aug 14, 2024
1 parent da9b352 commit 420e91f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 420e91f

Please sign in to comment.