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

@hackdonalds/emitter-socket

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hackdonalds/emitter-socket

## Table of Contents

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

HackDonalds' Emitter Socket

Table of Contents

  • Install
  • Usage
  • Examples
  • API
  • License

Emitter socket is used to emit events in a socket client swarm.

Client: A WebSocket client on browser

Server: Websocket server

Room: A namespace Client connects to

Socket messages between Client and Server are always typeof RemoteTrigger

Install

Install with npm install @hackdonalds/emitter-socket

Import in your project:

// ES6 Style
import EmitterClient from "@hackdonalds/emitter-socket"
// CommonJS
const EmitterClient = require("@hackdonalds/emitter-socket")

const peer = new EmitterClient({
    host: 'localhost',
    port: 8080,
    room: 'room_name_to_connect_to'
})

To run emitter server

import {server} from "@hackdonalds/emitter/socket/dist/server"
const PORT = process.env.PORT || 8080
server.listen(PORT)

Examples

Trigger the event on every peer connected to the room:

peer.triggerOnRoom('event_type',{
    ...yourData
})

Or trigger event on another peer

peer.triggerOnClient(clientID, 'event_name', {
    ...yourData
})

API

...

License

MIT License © Hilmi Tolga SAHIN

FAQs

Package last updated on 25 Apr 2020

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