-
Notifications
You must be signed in to change notification settings - Fork 253
Inbound vs Outbound #1571
Hi there,
just some thoughts on transport classes:
- it's a bit puzzling that InboundTransport start method does not take a message handler as a parameter
- node/transport/WsInboundTransport naming is misleading since its purpose is to send messages to the WS, not to receive inbound messages
- conversely, core/transport/WsOutboundTransport naming is misleading since its purpose is to receive messages, not to send messages. Moreover, having this class implement OutboundTransport translates into having 2 OutboundTransports on mobile (http and ws), which IIUC seems to result in MessageSender sending messages twice. Sending a message seems necessary to open the Websocket and actually start listening, which is puzzling...
All reactions
Replies: 2 comments
Hi Eric,
I can understand the naming is a bit puzzling, but it's actually the inverse of what you're stating. Outbound transports are used for outbound message, and inbound for inbound by default (this is important). That is, if transport return route is not configured, the outbound transports will only acts as outbound transprots, and the inbound transports will only act as inbound transports.
Due to an extension to didcomm, https://github.com/hyperledger/aries-rfcs/blob/main/features/0092-transport-return-route/README.md it is possible to also make an inbound channel able to reply to an inbound message, and for outbound transports to receive replies to their outbound message.
The inbound/outbound mainly refers to the first message, and who opens channel.
If you're only using servers, you would not need the transport return route extension, and in that case by default WsOutboundTransprot will only be used to send messages to the other party, and the WsInboundTransport will only be used to receive messages. Same with http outbound vs inbound
All reactions
"The inbound/outbound mainly refers to the first message, and who opens channel."
Wouldn't you agree that opening a channel and sending the first message are 2 different drivers ?
Typically with WS, the channel is opened by the client, and all messages are sent by the server ?
Practically, in a react-native app, you can only use WsOutboundTransport and HttpOutboundTransport, which both implement OutboundTransport, and none of which implements InboundTransport.
const wsTransport = new WsOutboundTransport();
const httpTransport = new HttpOutboundTransport();
agent_.registerOutboundTransport(wsTransport);
agent_.registerOutboundTransport(httpTransport);
So you end up having 2 outbound transports, and no inbound one, which is more than puzzling...