1.0.29 • Published 1 month ago

w-websocket-client v1.0.29

Weekly downloads
21
License
MIT
Repository
github
Last release
1 month ago

w-websocket-client

A wrapper for websocket in nodejs and browser.

language npm version license gzip file size npm download npm download jsdelivr download

Documentation

To view documentation or get support, visit docs.

Installation

Using npm(ES6 module):

Note: w-websocket-client is mainly dependent on ws

npm i w-websocket-client

Example for w-websocket-client:

Link: [dev source code]

import WSC from 'w-websocket-client/dist/w-websocket-client.umd.js'

let opt = { url: 'ws://localhost:8080', token: '*', open: function() { console.log('client nodejs: open')

    //send
    wsc.send('abc')

},
close: function() {
    console.log('client nodejs: close')
},
message: function(data) {
    console.log('client nodejs: message', data)
},
error: function(err) {
    console.log('client nodejs: error:', err)
},

}

//WSC let wsc = new WSC(opt)

### In a browser(UMD module):
> **Note:** `w-websocket-client` does't depend on any package in browser.

[Optional] Add script with nomodule for IE11.
```alias
<script nomodule src="https://cdn.jsdelivr.net/npm/@babel/polyfill/dist/polyfill.min.js"></script>

Necessary Add script for w-websocket-client.

<script src="https://cdn.jsdelivr.net/npm/w-websocket-client@1.0.29/dist/w-websocket-client.umd.js"></script>

Example for w-websocket-client:

Link: [dev source code]

//opt
let opt = {
    url: 'ws://localhost:8080',
    token: '*',
    open: function() {
        console.log('client web: open')
    //send
    wsc.send('abc')

},
close: function() {
    console.log('client web: close')
},
message: function(data) {
    console.log('client web: message', data)
},
error: function(err) {
    console.log('client web: error:', err)
},

}

//WSC let WSC = window'w-websocket-client' let wsc = new WSC(opt)

1.0.29

1 month ago

1.0.28

2 months ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.27

1 year ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

3 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.8

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago