ws5
v11.5.3
Published
WS V5
Downloads
8
Maintainers
Readme
WS5
WS V5
Installation
$ npm i ws5
Usage-Browser
Client:
<!DOCTYPE html>
<script src="https://unpkg.com/[email protected]/ws5-browser.js"></script>
<script>
const ws = new WebSocket5('ws://www.host.com/path')
ws.on('open', () => {
console.log('WebSocket Connected')
})
ws.on('message', (message) => {
console.log(message)
})
ws.on('close', () => {
console.log('WebSocket Disconnected')
})
ws.on('error', (error) => {
console.log(`WebSocket Error: ${error}`)
})
Usage-Node
Client:
const WebSocket5 = require('ws5')
const ws = new WebSocket5('ws://www.host.com/path')
ws.on('open', () => {
console.log('WebSocket5 Connected')
})
ws.on('message', (message) => {
console.log(message)
})
Server:
const WebSocket5 = require('ws5')
const ws = new WebSocket5.Server({
port: 8080
// Options Are The Same As With WS
})
ws.on('connection', () => {
console.log('Client Connected')
})