npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

adonis-websocket-client

v1.0.2

Published

<p align="center"> <a href="http://adonisjs.com"><img src="https://cloud.githubusercontent.com/assets/2793951/19925021/865beda4-a0ee-11e6-85bb-20ccd8f72211.png" alt="AdonisJs WebSocket"></a> </p>

Readme

Table of Contents

CommonJs

npm i --save adonis-websocket-client

CDN

You can grab the script file from unpkg.com.

Getting started is simple.

const ws = require('adonis-websocket-client')
// or available as global when using the script file from CDN
const io = ws('http://localhost:3333')

Connecting to a channel

AdonisJs comes with inbuilt support for channels and rooms. In order to communicate with the websocket server, you are required for connect to a channel first.

const chat = io.channel('chat').connect()
chat.on('message', function (message) {
  // do something with the message
})

Emitting Messages

chat.emit('message', 'Some message from client')

Join A Room

const data = {}
chat.joinRoom('watercooler', data, function (error, joined) {
  // acknowledgement that you have joined the channel
})

Leave A Room

const data = {}
chat.leaveRoom('watercooler', data, function (error, joined) {
  // acknowledgement that you have left the channel
})

Using With Vuejs

I love Vuejs to be core and here's how you are going to use it with Vuejs.

const ws = require('adonis-websocket-client')
const wsVuePlugin = function (Vue, url, options) {
  Vue.prototype.$io = ws(url, options)
}
Vue.use(wsVuePlugin, 'http://localhost:3333', {})

Now you make use of the $io on all of your components.

Connect To A Channel

new Vue({
  el: '#app',
  created: function () {
    this.$io.channel('chat').connect()
  }
})

Listening for events

<script>
  export default {
    data: function () {
      return {
        messages: []
      }
    },
    created: function () {
      this.$io.on('message', (message) => {
        this.messages.push(message)
      })
    }
  }
</script>

Contribution Guidelines

In favor of active development we accept contributions from everyone. You can contribute by submitting a bug, creating pull requests or even improving documentation.

You can find a complete guide to be followed strictly before submitting your pull requests in the Official Documentation.