0.0.4 • Published 1 year ago

socketman v0.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

SocketMan

This package is a developer tool for monitoring and testing Socket.IO events.

Getting Started

  1. Download the npm package npm i socketman
  2. Add socketman.io to the cors property of your Socket.IO server instance
  3. Invoke the setup method using your Socket.IO server instance
const { createServer } = require("http");
const { Server } = require("socket.io");
const { setup } = require("socketman");

const httpServer = createServer();

const io = new Server(httpServer, {
  cors: {
    origin: ["http://socketman.io"]
  }
});

setup(io);

httpServer.listen(3000);
  1. Navigate to socketman.io socketman.io in your browser
  2. Use the credentials from the setup method to create a connection between the webpage's socket instance and your server

Options

setup(io, options)

namespaceName: string?
auth: {username, password} | false

namespaceName optional

Default: '/admin'

The name of the namespace which will be created to inteface with socketman.io

auth mandatory

Default: -

If specifying options, auth is mandatory. Auth can be disabled:

setup(io, {
  auth: false
});

Or enabled:

setup(io, {
  auth: false
});

Usage

Listen Page

All events will be logged to the Listen page. Here events can be filtered by attributes including:

  • Event Name
  • Room
  • Namespace
  • Direction (Incoming, Outgoing, Test Emit)
  • Socket ID

Emit Page

Test events on this page. Create an event by providing an event name. Optionally, add any desired payloads or a callback. Payloads must be provided in JSON format; a red indicator will appear on the argument if the JSON is invalid or does not match the user-defined type.

Save an event by giving it a name in the Save or Load Event section of the page and then clicking "Save Event". Saved events are added to local storage. To load an event, select one from the dropdown.


Contributors

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago