socketless-server

0.1.2 • Public • Published

socketless-server

WIP: A websocket router for serverless apps. Follow on Github.

npm CircleCI coverage MIT License

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.

Dependencies (6)

Dev Dependencies (3)

Package Sidebar

Install

npm i socketless-server

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

22.9 kB

Total Files

10

Last publish

Collaborators

  • gadicc