Coder Social home page Coder Social logo

indicio-tech / aries-socketdock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hyperledger/aries-socketdock

0.0 0.0 0.0 225 KB

Websocket Relay Service for use with clustered Mediators

License: Apache License 2.0

Shell 5.14% JavaScript 0.75% Python 89.08% Dockerfile 5.03%

aries-socketdock's Introduction

SocketDock

A WebSocket Relay Service

SocketDock serves as a relay between WebSocket-oriented agents and backends that don't support WebSockets natively. Arbitrarily many instances of SocketDock can be spun up behind a load balancer, which serves WebSocket connections to a specific instance of SocketDock. SocketDock will receive messages addressed to the backend and transport them across HTTP to the backend. No state is shared between instances of SocketDock, allowing for easy scaling.

Messages are forwarded unmodified, with some additional metadata to allow the backend to associate the sender of the message with the SocketDock instance it's connected to (see messageuri below). When a WebSocket is terminated, SocketDock will send a message to the disconnecturi, informing the backend that the connection has been terminated.

SocketDock

Configuration

bindip and bindport

These reference what the instance of SocketDock is running on. This is where inbound WebSockets connect.

messageuri

This is the HTTP endpoint of whatever backend that SocketDock is in front of. SocketDock will pass messages, along with some metadata, to this endpoint.

Note: message is sent as a string, not a JSON object

{
    "meta": {
                "connection_id": <socket_id>,
                "send": "http://<externalhostandport>/socket/<socket_id>/send",
            }, 
    "message": message
}

disconnecturi

When a WebSocket is terminated, SocketDock will inform the backend of the disconnect. This allows the backend to proactively adjust its behavior—queueing messages instead of attempting live delivery, in case of a mediator, for example.

If a SocketDock instance fails, the backend won't know of the terminated connection and will attempt to behave normally. In that case, an error will be thrown when attempting to POST to the endpoint, and the backend should adjust its behavior at that time.

externalhostandport

This is the endpoint on which SocketDock is expecting responses from the backend. This information is used to construct the callback URI (see messageuri above).

backend

This variable currently has 2 options: loopback and http. This determines which backend SocketDock is expecting. loopback turns SocketDock into an echo server, where any message sent to it SocketDock is immediately sent directly back. This option is primarily used for local testing and demoing. http is used when an HTTP-enabled backend implementation is being used, as in many production scenarios.

Additional backends may be added in the future, as need arises.

aries-socketdock's People

Contributors

dbluhm avatar mepeltier avatar swcurran avatar telegramsam avatar thetechmage avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.