Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: process ws return route messages serially #826

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/core/src/transport/WsOutboundTransport.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { AgentMessageReceivedEvent } from '..'
TimoGlastra marked this conversation as resolved.
Show resolved Hide resolved
import type { Agent } from '../agent/Agent'
import type { Logger } from '../logger'
import type { OutboundPackage } from '../types'
Expand All @@ -7,6 +8,7 @@ import type WebSocket from 'ws'

import { AgentConfig } from '../agent/AgentConfig'
import { EventEmitter } from '../agent/EventEmitter'
import { AgentEventTypes } from '../agent/Events'
import { AriesFrameworkError } from '../error/AriesFrameworkError'
import { isValidJweStructure, JsonEncoder } from '../utils'
import { Buffer } from '../utils/buffer'
Expand Down Expand Up @@ -109,7 +111,12 @@ export class WsOutboundTransport implements OutboundTransport {
)
}
this.logger.debug('Payload received from mediator:', payload)
void this.agent.receiveMessage(payload)
this.eventEmitter.emit<AgentMessageReceivedEvent>({
type: AgentEventTypes.AgentMessageReceived,
payload: {
message: payload,
},
})
}

private listenOnWebSocketMessages(socket: WebSocket) {
Expand Down