Skip to content

Commit

Permalink
refactor: add logs to decrypted message
Browse files Browse the repository at this point in the history
  • Loading branch information
xstelea committed Jan 31, 2024
1 parent 2aa213d commit 7d549c9
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions src/connector/signaling/signaling-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export const SignalingClient = (input: {
else if (message.info !== 'confirmation')
logger?.trace(`🛰💬⬇️ received:`, message)

logger?.trace(message)
subjects.onMessageSubject.next(message)
})
}
Expand Down Expand Up @@ -182,7 +181,15 @@ export const SignalingClient = (input: {
decryptMessagePayload<Offer['payload']>(
message.data,
input.secrets.encryptionKey,
),
)
.map((result) => {
logger?.debug(result)
return result
})
.mapErr((err) => {
logger?.error(err)
return err
}),
),
filter((result): result is Ok<Offer['payload'], never> => !result.isErr()),
map(
Expand All @@ -202,7 +209,15 @@ export const SignalingClient = (input: {
decryptMessagePayload<Answer['payload']>(
message.data,
input.secrets.encryptionKey,
),
)
.map((result) => {
logger?.debug(result)
return result
})
.mapErr((err) => {
logger?.error(err)
return err
}),
),
filter((result): result is Ok<Answer['payload'], never> => !result.isErr()),
map(
Expand All @@ -222,7 +237,15 @@ export const SignalingClient = (input: {
decryptMessagePayload<IceCandidate['payload']>(
message.data,
input.secrets.encryptionKey,
),
)
.map((result) => {
logger?.debug(result)
return result
})
.mapErr((err) => {
logger?.error(err)
return err
}),
),
filter(
(result): result is Ok<IceCandidate['payload'], never> => !result.isErr(),
Expand Down

0 comments on commit 7d549c9

Please sign in to comment.