1.1.7 • Published 2 years ago

quick-ws-server v1.1.7

Weekly downloads
-
License
ISC
Repository
-
Last release
2 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

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

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