
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@adonisjs/websocket-packet
Advanced tools
This library is used to create/validate the websocket packets used by AdonisJs.
If you are writing a Javascript client, this is the library you must use. When writing client libraries for other platforms, simply follow the docs and the code to create your implementations.
npm i --save @adonisjs/websocket-packet
const wsp = require('@adonisjs/websocket-packet')
// or
import wsp from '@adonisjs/websocket-packet'
console.log(wsp.codes)
wsp.isJoinPacket(packet)
<script src="https://unpkg.com/@adonisjs/websocket-packet"></script>
<script type="text/javascript">
console.log(adonis.wsp.codes)
console.log(adonis.wsp.isJoinPacket(packet))
</script>
BooleanValidates if packet code is a JOIN code.
BooleanValidates if packet code is a LEAVE code.
BooleanValidates if packet code is a OPEN code.
BooleanValidates if packet code is a JOIN_ACK code.
BooleanValidates if packet code is a JOIN_ERROR code.
BooleanValidates if packet code is a LEAVE_ACK code.
BooleanValidates if packet code is a LEAVE_ERROR code.
BooleanValidates if packet code is a EVENT code.
BooleanValidates if packet code is a PING code.
BooleanValidates if packet code is a PONG code.
BooleanFinding if a packet has a topic.
BooleanMakes sure packet is a valid join packet. Do call isJoinPacket
before calling this method.
BooleanMakes sure packet is a valid leave packet. Do call isLeavePacket
before calling this method.
BooleanMakes sure packet is a valid event packet. Do call isEventPacket
before calling this method.
ObjectMakes a join packet
ObjectMakes a leave packet
ObjectMakes join acknowledge packet
ObjectMakes join error packet
ObjectMakes leave packet
ObjectMakes leave error packet
ObjectMakes the event packet
ObjectMakes ping packet
ObjectMakes pong packet
ObjectPacket codes. The actual packet will have the numbers
Kind: global constant
Example
{
OPEN: 0,
JOIN: 1,
LEAVE: 2,
JOIN_ACK: 3,
JOIN_ERROR: 4,
LEAVE_ACK: 5,
LEAVE_ERROR: 6,
EVENT: 7,
PING: 8,
PONG: 9
}
Fns to be exported
BooleanValidates if packet code is a JOIN code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a LEAVE code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a OPEN code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a JOIN_ACK code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a JOIN_ERROR code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a LEAVE_ACK code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a LEAVE_ERROR code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a EVENT code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a PING code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanValidates if packet code is a PONG code.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanFinding if a packet has a topic.
Kind: global function
| Param | Type |
|---|---|
| packet | Object |
BooleanMakes sure packet is a valid join packet. Do call isJoinPacket
before calling this method.
BooleanMakes sure packet is a valid leave packet. Do call isLeavePacket
before calling this method.
BooleanMakes sure packet is a valid event packet. Do call isEventPacket
before calling this method.
ObjectMakes a join packet
Kind: global function
Throws:
Error If topic is not defined or not a string| Param | Type |
|---|---|
| topic | String |
ObjectMakes a leave packet
Kind: global function
Throws:
Error If topic is not defined or not a string| Param | Type |
|---|---|
| topic | String |
ObjectMakes join acknowledge packet
Kind: global function
Throws:
Error If topic is not defined or is not a string| Param | Type |
|---|---|
| topic | String |
ObjectMakes join error packet
Kind: global function
Throws:
Error If topic is not defined or not a stringError If message is not defined or not a string| Param | Type |
|---|---|
| topic | String |
| message | String |
ObjectMakes leave packet
Kind: global function
Throws:
Error If topic is not defined or not a string| Param | Type |
|---|---|
| topic | String |
ObjectMakes leave error packet
Kind: global function
Throws:
Error If topic is not defined or not a stringError If message is not defined or not a string| Param | Type |
|---|---|
| topic | String |
| message | String |
ObjectMakes the event packet
Kind: global function
Throws:
Error If topic is not defined or not a stringError If event is not definedError If data is not defined| Param | Type |
|---|---|
| topic | String |
| event | String |
| data | Mixed |
ObjectMakes ping packet
ObjectMakes pong packet
Kind: global function
FAQs
Verify,create adonis websocket packets
The npm package @adonisjs/websocket-packet receives a total of 1,225 weekly downloads. As such, @adonisjs/websocket-packet popularity was classified as popular.
We found that @adonisjs/websocket-packet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.