Package Exports
- nanosocket
 - nanosocket/fake
 
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nanosocket) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Nanosocket
- Tiny: ~20 lines, ~1 kb bundled
 - Handles reconnection with exponential backoff
 - Receive responses via callback/promise/stream (checkout emitterify)
 
example.html:
const socket = nanosocket('wss://echo.websocket.org')
// to connect to the same origin:
// const socket = nanosocket()
// log stream of incoming messages
socket.on('recv').map(d => console.log("recv", d))
// log all connection events
socket.on('connected').map(d => console.log("connected", d))
// log all disconnection events
socket.on('disconnected').map(d => console.log("disconnected", d))
// send a message
// note that this returns a promsie for when the message is actually sent
// since you can send when disconnected, and it will send after reconnecting etc
socket.send('boo').then(d => console.log("sent", d))