Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fauxnix

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fauxnix

A fake websocket connection for Phoenix channels

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Fauxnix

NOTE: Fauxnix is a new project and is likely to change.

Fauxnix is a mock websocket connection for receiving and responding to Phoenix channel messages and is heavily inspired by Pretender.

Usage

Fauxnix allows you to create a fake websocket connection and replace the returned object of new WebSocket() calls with the socket you passed in.

const socket = new Fauxnix(function() {
  this.receive("topic", "event", function(payload) {
    return { status: "ok", response: { id: payload.id } };
  });
});

Fauxnix.inject(socket);

Whenever socket receives a message from phoenix.js with a topic of "topic" and an event of "event" Fauxnix will send a reply with the given status and response in the return statement. The payload from a message is passed in as the first argument to this.receives callback.

The call to Fauxnix.inject replaces the returned object of all new WebSocket() calls with the socket we defined.

The topic and event arguments also accept regular expressions.

Contributing

See the CONTRIBUTING document. Thank you, contributors!

License

Fauxnix is Copyright © 2015 thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About thoughtbot

thoughtbot

Fauxnix is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or hire us to design, develop, and grow your product.

Keywords

FAQs

Package last updated on 10 May 2015

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc