package
0.0.0-20210805150241-449d0e09d70b
Repository: https://github.com/project-flogo/websocket.git
Documentation: pkg.go.dev

# README

WebSocket Server

This trigger provides your Microgateway application with the ability to operate as a web socket server.

Schema

Settings, Outputs and Handlers:

{
 "settings":[
    {
      "name": "port",
      "type": "integer"
    },
    {
      "name": "enableTLS",
      "type": "boolean"
    },
    {
      "name": "serverCert",
      "type": "string"
    },
    {
      "name": "serverKey",
      "type": "string"
    },
    {
      "name": "enableClientAuth",
      "type": "boolean"
    },
    {
      "name": "trustStore",
      "type": "string"
    }
  ],
  "outputs": [
    {
      "name": "pathParams",
      "type": "params"
    },
    {
      "name": "queryParams",
      "type": "params"
    },
    {
      "name": "headers",
      "type": "params"
    },
    {
      "name": "content",
      "type": "any"
    },
    {
      "name": "wsconnection",
      "type": "any"
    },
  ],
  "handler": {
    "settings": [
      {
        "name": "method",
        "type": "string"
      },
      {
        "name": "path",
        "type": "string"
      },
      {
        "name": "mode",
        "type": "string"
      }
    ]
  }
}

Settings

KeyDescription
portThe port to listen on
enableTLStrue - To enable TLS (Transport Layer Security), false - No TLS security
serverCertServer certificate file in PEM format. Need to provide file name along with path. Path can be relative to gateway binary location.
serverKeyServer private key file in PEM format. Need to provide file name along with path. Path can be relative to gateway binary location.
enableClientAuthtrue - To enable client AUTH, false - Client AUTH is not enabled
trustStoreTrust dir containing clinet CAs

Outputs

KeyDescription
pathParamsHTTP request path params
queryParamsHTTP request query params
headersHTTP request header params. Header key gets converted in to canonical format, i.e. the first letter and any letter following a hyphen to upper case, the rest are converted to lowercase. For example, the canonical key for "accept-encoding" and "host" are "Accept-Encoding" and "Host" respectively
contentHTTP request payload
wsconnectionThe websocket connection

Handler settings

KeyDescription
methodHTTP request method. It can be
pathURL path to be registered with handler
mode"1" for output with content and "2" for output with wsconnection

Example Configurations

{
  "name": "tibco-wssub",
  "id": "flogo-WSMessageTrigger",
  "ref": "github.com/project-flogo/websocket/trigger/wsserver",
  "settings": {
    "port": "9096",
    "enableTLS": false,
    "serverCert": "",
    "serverKey": "",
    "enableClientAuth": false,
    "trustStore": ""
  },
  "handlers": [
    {
      "settings": {
        "method": "GET",
        "path": "/ws",
        "mode": "1"
      },
      "actions": [
        {
          "id": "microgateway:Pets"
        }
      ]
    }
  ]
}

# Packages

No description provided by the author

# Functions

NewServer create a new server instanceparam server - is a instance of http.Server, can be nil and a default one will be created.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

ModeConnection sends connections to the action.
ModeMessage sends messages to the action.

# Structs

Factory is a factory for websocket servers.
HandlerSettings are the settings for a handler.
No description provided by the author
Output are the outputs of the websocket server.
No description provided by the author
Server the server structure.
Settings are the settings for the websocket server.
Trigger trigger struct.