1.1.7 • Published 4 years ago

quick-ws-server v1.1.7

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

quick-ws-server


Support heartbeat and disconnection reconnection

examples

client

import WsServer from 'quick-ws-server'
const wsServer = new WsServer({
  url: 'ws://localhost:4800'
})

wsServer.sendMsg(JSON.stringify({
  time: Date.now(),
  msg: 'hei'
})).then(res => {
  // {
  //   msg: 'hello'
  // }
  console.log(res)
})

server

const WsServer = require('quick-ws-server')

const wsServer = new WsServer({
  port: 4800
})

wsServer.onmessage = (ws, data) => {
  // message:
  // {
  //   time: Date.now(),
  //   msg: 'hei'
  // }
  console.log(JSON.parse(data))
  // reply
  ws.send(JSON.stringify({
    msg: 'hello'
  }))
}
1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.23

4 years ago

1.0.22

4 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

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago