Coder Social home page Coder Social logo

websocket-broadcast's Introduction

Buy Me A Coffee

websocket-broadcast

Broadcasts received messages over websockets.

Install

npm install -g websocket-broadcast

How it works

It opens a websocket connection on port 3333. Clients connected to this server can broadcast messages between them. The client who sends a message doesn't receive it back, it's sent to the other clients only.

Client IDs

After each clients connects it will get a UUID V1 from websocket-broadcast. Useful if you need to identify your clients with a unique ID.

UUID will be sent in a message with type uuid, something like this:

{type: 'uuid', data: 'ed8ef0b0-35ff-11e7-8de4-6bd9049b7aa7'}

When a client is disconnected a message will be sent as well:

{type: 'disconnect', message: 'cya'}

You can disable ID generation by setting the --noid modifier:

websocket-broadcast --noid

Note that disconnection messages won't be sent when --noid is set.

Customize port

You can set a custom port by using the -p param:

websocket-broadcast -p 8080

SSL support

If you need a secure connection (wss) simply pass your credential and key to use them:

websocket-broadcast --cert /path/to/cert.pem --key path/to/key.pem

Logging

By default it will log every received message.

If you want to turn off logging you can use the --nolog:

websocket-broadcast --nolog

websocket-broadcast's People

Contributors

codealchemist avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.