New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

adonisjs-websocket

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonisjs-websocket

Websocket provider for AdonisJS

  • 0.0.6
  • npm
  • Socket score

Version published
Weekly downloads
172
increased by34.38%
Maintainers
0
Weekly downloads
 
Created
Source

AdonisJS Websocket

node ace add adonisjs-websocket

Usage

// start/routes.ts
router.ws('/ws', ({ ws }) => {
  ws.on('message', (message) => {
    ws.send('Received: ' + message.toString())
  })
})
npx wscat -c "ws://localhost:3333/ws"
// start/routes.ts
router.ws(
  '/rooms/:roomId',
  ({ ws, params, auth }) => {
    const roomId = params.roomId
    const user = auth.user

    if (user.isBanned) {
      return ws.close()
    }

    ws.on('message', (message) => {
      ws.send('Received: ' + message.toString())
    })
  },
  [
    () => import('#middleware/container_bindings_middleware'),
    () => import('@adonisjs/auth/initialize_auth_middleware'),
    middleware.auth(),
  ]
)
npx wscat -c 'ws://localhost:3333/rooms/1' -H 'Authorization: Bearer oat_MjU.Z25o...'
npx wscat -c 'ws://localhost:3333/rooms/1?token=oat_MjU.Z25o...'

FAQs

Package last updated on 10 Oct 2024

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