Socket
Socket
Sign inDemoInstall

websocket-mock-server

Package Overview
Dependencies
204
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    websocket-mock-server

provide mock server for native websocket test


Version published
Weekly downloads
160
decreased by-34.96%
Maintainers
1
Install size
5.14 MB
Created
Weekly downloads
 

Readme

Source

A simple and configurable mock server with UI console for websocket, with which you can either send message manually or make rules to get matched response. Err... It's hard to summarize, Let's take a look!

Installation

npm package

npm install websocket-mock-server

github repo

git clone https://github.com/EmiyaYang/websocket-mock-server.git
npm install
npm run build
npm run test

Configuration

package.json

{
  "script": {
    "mock": "wsmock -c CONFIG_PATH"
  }
}

The following config.js will be used and watched as default config when no CONFIG_PATH is provided.

module.exports = {
  port: 4040,
  // a function exported to handle specific input and return output which will be sending later.
  rule: function (input) {}
  // set the delay time before sending auto message 
  autoMsgTimeout: 1000,
};

Run

Terminal

npm run mock

preview

The frontend provide a chatroom-like way for you to send WebSocket message to server, which will be broadcast to other clients.

TODO

  • feat: Serial message flow test;

Keywords

FAQs

Last updated on 06 Jan 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc