Adonis Websocket is the official **websockets** provider for AdonisJs. It lets you easily setup/authenticate channels and rooms with elegant syntax and power of ES2015 generators.:rocket:
## Setup Follow the below instructions to setup this provider
npm i --save adonis-websocket
All providers are registered inside bootstrap/app.js
file.
const providers = [
'adonis-websocket/providers/WsProvider'
]
Aliases makes it easier to reference a namespace with a short unique name. Aliases are also registered inside bootstrap/app.js
file.
const aliases = {
Ws: 'Adonis/Addons/Ws'
}
Setup process is done. Let's use the Ws provider now.
## Getting Started
Feel free to skip this section and read the official documentation, if you are on version 3.2
or later.
If you are using older version of adonis-app
. You are supposed to create couple of directories in order to setup the ecosystem.
Below are the bash commands to create required directories. Equivalent commands for windows can be used.
mkdir app/Ws
mkdir app/Ws/Controllers
touch app/Ws/socket.js
Next we need to do is loading the socket.js
file when starting the server. Which will be inside bootstrap/http.js
file. Paste the below line of code after use(Helpers.makeNameSpace('Http', 'routes'))
use(Helpers.makeNameSpace('Ws', 'socket'))
Next, read the official documentation ๐
## 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.