Giter VIP home page Giter VIP logo

wsaas's Introduction

Web Socket as a Service

Current status: Prototype

This project aim to help system scale their websocket interface. It should be used with a distributed or a lambda base system.

It is inspired by the Amazon Web Service API Gateway with the Websocket flavor, but aim to remove most of the complexity of the service.

Why

When you want to support websocket on a distributed system, you will often end up in the situation where the event you want to forward to the front end is not detected on the server holding the websocket connection. This server will provide you a web hook interface so pushing and getting clients information is just a classic REST http interface.

General interface description

This server rely on two environment variable to work (Those are my test setup):

export API_URI=localhost:80/websocket
export WS_HOSTNAME=localhost:8080

The API_URI parameter is the hostname + path that the WSAAS will use to push information to your system.

This path should support 3 different HTTP method:

  • POST Will be called when a new connection is created
  • PUT Will be called when the client push information through the websocket.
  • DELETE Will be called after the client close the connection. Use it to maintain integrity in your system as the

The POST request will contain a ws_uri parameter that will look like <WS_HOSTNAME>/some_id

This endpoint support the following method:

  • PUT Push information to the client
  • DELETE Close connection

Interfaces and protocol details

Websocket creation

POST request:

Header: {
    "Authorization": "Content of the initial query Authorization header",
},
Body: {
    "ws_uri": "some_uri_to_use_later/id",
}

POST response:

Body: {
    "code": "OK",
}

Sending any other code value will kill the connection

Security

Client side

TODO (I think I can just summon the https over the interface but double check WS security)

Push to api

Have your api support https

Server push

  • Have a firewall/security groups so WSAAS only get talked to by your api
  • TODO: HTTPS settings

Additional settings

# Set log level
export LOG_LEVEL=INFO       # value: ERROR|WARN|INFO|DEBUG
export WS_TIMEOUT=30000     # Timeout value in ms

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.