New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@lytejs/ws

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lytejs/ws

Websockets on steroid

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

Websocket Plus

This provides an HTTP similar API for using Websockets in Node/Browser.

Example

// Sending Message
const wsp = new WebSocket(socket)
wsp.client.post('/friend-request', { body: {
  userId: 'johndoe'
}})


// Receiving Message
const wsp = new WebSocket(socket)
wsp.router.post('/friend-request', (req, res) => {
  const userId = req.data.userId
  wsp.client.post('/friend-request', {
    body: {
      senderId: socket.id
    },
    socketId: userId
  })
})

// Receiving Message on the receiver browser

const wsp = new WebSocket(socket)
wsp.router.post('/friend-request', (req, res) => {
  const userId = req.data.userId
  // Show friend request popup using req.data
  res.status(200)
})

Template

FAQs

Package last updated on 27 May 2022

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