mudebug-socket
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

mudebug-socket

A wrapper of any mudb sockets and socket servers for simulating network conditions.

usage

To simulate network conditions on the client side.

// downstream latency of ~100 ms
new MuDebugSocket({
    socket, // a MuSocket
    inLatency: 100,
})
 
// downstream jitter up to 30 ms
new MuDebugSocket({
    socket,
    inJitter: 30,
})
 
// ~1% downstream packet loss
new MuDebugSocket({
    socket,
    inPacketLoss: 1,
})
 
// upstream latency of ~100 ms
new MuDebugSocket({
    socket,
    outLatency: 100,
})
 
// upstream jitter up to 30 ms
new MuDebugSocket({
    socket,
    outJitter: 30,
})
 
// ~1% upstream packet loss
new MuDebugSocket({
    socket,
    outPacketLoss: 1,
})

You can pass in any combinations of the above to simulate the condition that you need. Also, you can simulate the same set of network conditions on the server side.

Unlike in other mudb socket modules, MuDebugSocket and MuDebugServer are designed to be asymmetrical, meaning you don't have to use both at the same time.

table of contents

1 install

npm i mudebug-socket

2 api

2.1 class: MuDebugServer

2.1.1 new MuDebugServer(spec)

  • spec:object
    • socketServer:MuSocketServer
    • inLatency?:number
    • inJitter?:number
    • inPacketLoss?:number
    • outLatency?:number
    • outJitter?:number
    • outPacketLoss?:number

2.2 class: MuDebugSocket

2.2.1 new MuDebugSocket(spec)

  • spec:object
    • socket:MuSocket
    • inLatency?:number
    • inJitter?:number
    • inPacketLoss?:number
    • outLatency?:number
    • outJitter?:number
    • outPacketLoss?:number

3 TODO

  • tampered packets
  • low bandwidth
  • slow open
  • out-of-order packets
  • duplicate packets
  • throttling

credits

Copyright (c) 2018 He Diyi, Shenzhen Dianmao Technology Company Limited

Package Sidebar

Install

npm i mudebug-socket

Weekly Downloads

9

Version

0.1.5

License

MIT

Unpacked Size

77.8 kB

Total Files

27

Last publish

Collaborators

  • esdoppio