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

Support WebSockets Transport for DID Comm #144

Closed
FabioPinheiro opened this issue Oct 24, 2023 · 2 comments
Closed

Support WebSockets Transport for DID Comm #144

FabioPinheiro opened this issue Oct 24, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@FabioPinheiro
Copy link
Contributor

FabioPinheiro commented Oct 24, 2023

Transport via WebSocket

DID Comm is supposed to be Transport-agnostic
Notes from the official specification

Value brief

The main intended values to implement this feature are:

  • efficiency - Websocket is an efficient way to send several messages with no TPC overhead.
  • new use cases - by having a two-way channel of communication:
    • Avoid polling and remove the overhead of individual requests.
    • Near real-time communication
    • Multiplexing networking - using one single transport to have multiple conversations (different instance executions of protocols, or even using multiple identities).
    • Network Hub - Creation of a virtual hub or broadcast network between multiple participants
    • Ex: Live Mode in the Message Pickup Protocol

Implementation notes

The path will be https://<mediator>/ws. The creation of a WebSocket starts with the GET request with some headers. But since the GET on the root path, https://<mediator>/ its already used be a mediator’s website. Plus many proxies and libraries probably wouldn't support the distinction between getting the website and trying to create the WebSocket.

The header content-type with application/didcomm-encrypted+json will NOT be necessary since browsers do not support custom headers on WebSockets.

Support new transportation layer WebSockets.
It will work similarly to the HTTP post as defined on the DID Comm specification. So the client creates a WebSocket to be used as a one-way channel, to send messages from the client to the server.
When the message is the return_route flag (with all/thread) the same WebSocket would be used to get the reply as specified on the DID Comm Book - extension return_route.

The infrastructure also needs to be configured for the Proxy to support WebSockets

Is not clean from the specs the best way to support back pressure. In extreme conditions, messages can be lost without the WebSockets break. Another possible scenario, depending on implementation, is that the client is blocked because it's not able to send data via TCP.
To have better control let's have a small buffer with a configurable size controlled by us to store incoming messages while messages are being processed.

We need to keep internal metadata manage open WebSockets:

  • Who is on the other side of the WebSockets?
    • Unknown - there is no previous message.
    • Set[DID] - one or more subjects based on the previous encrypted message sent.
  • For each DID where was the last message with the flag return_route=all.
  • For each Par(DID,thread) where was the last message with the flag return_route=thread.

Bloking

This ticket unblocked the implementation of the Live Mode in the Message Pickup Protocol

@FabioPinheiro
Copy link
Contributor Author

The infrastructure also needs to be configured for the Proxy to support WebSockets

@FabioPinheiro
Copy link
Contributor Author

The first step is done (update the HTTP lib) -> #165

FabioPinheiro added a commit that referenced this issue Nov 22, 2023
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
mineme0110 pushed a commit that referenced this issue Apr 30, 2024
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
mineme0110 pushed a commit that referenced this issue Apr 30, 2024
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
Signed-off-by: Fabio <Pinheiro>
mineme0110 pushed a commit that referenced this issue May 1, 2024
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
Signed-off-by: Fabio <Pinheiro>
mineme0110 pushed a commit that referenced this issue May 1, 2024
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
Signed-off-by: Fabio Pinheiro <[email protected]>
mineme0110 pushed a commit that referenced this issue May 1, 2024
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
Signed-off-by: Fabio Pinheiro <[email protected]>
Signed-off-by: mineme0110 <[email protected]>
mineme0110 pushed a commit that referenced this issue May 1, 2024
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
Signed-off-by: Fabio Pinheiro <[email protected]>

Signed-off-by: Shailesh Patil <[email protected]>
mineme0110 pushed a commit that referenced this issue May 1, 2024
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
Signed-off-by: Fabio Pinheiro <[email protected]>

Signed-off-by: Shailesh Patil <[email protected]>
mineme0110 pushed a commit that referenced this issue May 1, 2024
Support DIDComm via Websockets
Support WebSocket URI as endpoints
Update scala-did to 0.1.0-M15
Use of Scala DID framework and Transport
Remove module 'http-utils'
Support multi endpoint in the config file
Better error handling
Configuration update
Cleanup duplicated code
Work for #144

---------

Signed-off-by: Pete Vielhaber <[email protected]>
Co-authored-by: Pete Vielhaber <[email protected]>
Signed-off-by: Fabio Pinheiro <[email protected]>

Signed-off-by: Shailesh Patil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant