Skip to content

Commit

Permalink
reuse decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
lauti7 committed Apr 24, 2024
1 parent d37d9fd commit 56136fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controllers/handlers/ws-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { AppComponents, WsUserData } from '../../types'
import { normalizeAddress } from '../../utils/address'
import { IUWebSocketEventMap, UWebSocketTransport } from '../../utils/UWebSocketTransport'

const textDecoder = new TextDecoder()

export async function registerWsHandler(
components: Pick<AppComponents, 'logs' | 'server' | 'metrics' | 'fetcher' | 'rpcServer'>
) {
Expand Down Expand Up @@ -56,7 +58,7 @@ export async function registerWsHandler(
data.timeout = undefined

try {
const authChainMessage = new TextDecoder().decode(message)
const authChainMessage = textDecoder.decode(message)

const verifyResult = await verify('get', '/', JSON.parse(authChainMessage), {
fetcher
Expand Down

0 comments on commit 56136fc

Please sign in to comment.