Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaronc81/websap
Light stateful protocol on top of HTTP for multi-user, multi-instance apps
https://github.com/aaronc81/websap
http protocol ruby
Last synced: 16 days ago
JSON representation
Light stateful protocol on top of HTTP for multi-user, multi-instance apps
- Host: GitHub
- URL: https://github.com/aaronc81/websap
- Owner: AaronC81
- Created: 2018-09-13T21:12:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-20T21:59:47.000Z (over 6 years ago)
- Last Synced: 2025-01-12T16:52:04.904Z (21 days ago)
- Topics: http, protocol, ruby
- Language: Ruby
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WebSAP
WebSAP is the **web session application protocol**. It allows multiple apps
to run simulatenously on the same server, each having a virtually infinite
number of concurrent sessions.## Protocol
- GET `/apps`: List supported apps
- GET `/apps/[app]/new`: Create a new app of type `app`. Returns the `id` of the
new session.
- GET `/apps/[id]/state`: Gets the state of the session.
- POST `/apps/[id]/message`: Posts a message to a session, invoking its app's
`transform` method.## Apps
Each app implementation needs three things:
1. `name`: The name of the app.
2. `initial_state`: The initial state of any new session for this app.
3. `transform(state, action, options)`: A function which takes an existing
state reference, an action string, and an options hash. `state` should be
mutated based on `action` and `options`. Return `true` if everything was
valid with `action` and `options`, or false otherwise.