@ws

Define WebSocket endpoint and Lambda handler functions.

Syntax

No other config required

Example

This app.arc file defines both HTTP and WebSocket endpoints:

arc
@app
myapp

@http
get /

@ws
# no other config required

json
{
  "architect": {
    "app": "myapp",
    "http": [
      [ "get", "/" ]
    ],
    "ws": {}
  },
  "start": "npx sandbox",
  "dependencies": {
    "@architect/architect": "latest"
  }
}
toml
app="testapp"

http=[
 [ "get", "/" ]
]

"ws"
# no other config required
yaml
---
app: testapp

http:
- get: "/"

ws: ~
# no other config required

Running arc create generates the following functions:

/
|-src
| |-http
| | '-get-index/
| '-ws
|   |-connect/
|   |-default/
|   '-disconnect/
'-app.arc