New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

micro-ws

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-ws

A parody of zeit/micro for WebSockets.

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

micro-ws

A parody of zeit/micro for WebSockets.

Example

const { event, send } = require('micro-ws')

module.exports = async (conn) => {
    const { name, data } = await event(conn)

    if (name === 'hello') {
        return send(conn, 'hello', { foo: 1 })
    }
}

I've forked the command-line code from micro, so it is similar:

micro-ws server.js --listen tcp://0.0.0.0:3001

TODO

I'm building this library to my needs in my projects, but I'm open to suggestions. Some ideas include:

  • Hosting a joint HTTP + WS server (using micro for HTTP interface).
  • Add more comprehensive functions for streamed messages.
  • Explore alternatives to ws for driving the WebSockets.

FAQs

Package last updated on 03 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts