socketless-server
v0.1.2
Published
Websocket microservice that routes to / interacts with serverless lambdas
Downloads
1
Readme
socketless-server
WIP: A websocket router for serverless apps. Follow on Github.
See https://github.com/socketless/socketless-project.
Quick Start
const SocketlessServer = require('socketless/server');
new SocketlessServer(/* optional config */);
# Lambdas to be called on new connection or incoming message
SOCKETLESS_ON_CONNECT_URL=
SOCKETLESS_ON_MESSAGE_URL=
# Ports (and their defaults) to accept new connections
SOCKETLESS_WEBSOCKET_PORT=4000
SOCKETLESS_REST_PORT=4000
# TODO
SOCKETLESS_REST_ALLOW=127.0.0.1
REDIS_DB=
API
onConnect
onMsg
SLS requests
An incoming websocket message (from a websocket client, i.e. browser), that begins with "SLS " (capital 'SLS' followed by a single space), will not be sent to onMsg lambdas. Instead, certain commands will be answered directly by the server.
SLS PING <payload>
The server will respond to the client with 'SLS PONG '. Useful to keep the connection alive and check latency. Also known as heartbeats.