1.0.14 • Published 2 years ago

@dartondox/websocket v1.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Dox Websocket client

Installation

Via cdn
https://cdn.jsdelivr.net/npm/@dartondox/websocket/dist/index.js
Via npm or yarn
$ npm install @dartondox/websocket

OR

$ yarn add @dartondox/websocket

Usage

import DoxWebsocket from '@dartondox/websocket';

const socket = DoxWebsocket('ws://127.0.0.1:3001/ws', {
  maxRetries: 18, retryAfter: 2000 
})

socket.onConnected(() => {
  console.log(socket.id)
})

socket.onError(() => {
  console.log('socket error')
})

socket.on('intro', (msg) => {
  console.log(msg)
})

socket.onClose(() => {
  console.log('socket closed')
})

function send() {
  socket.emit('intro', { data: message.value })
}
1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago