Guest User

Untitled

a guest
May 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. const clientPlugin = createPlugin()
  2. const clientConn = await IlpStream.createConnection({
  3. plugin: clientPlugin,
  4. destinationAccount,
  5. sharedSecret
  6. })
  7.  
  8. // Streams are automatically given ids (client-initiated ones are odd, server-initiated are even)
  9. const streamA = clientConn.createStream()
  10. const streamB = clientConn.createStream()
  11.  
  12. console.log(`sending data to server on stream ${streamA.id}`)
  13. streamA.write('hello there!')
  14.  
  15. console.log(`sending data to server on stream ${streamB.id}`)
  16. streamB.write('hello there!')
  17.  
  18. console.log(`sending money to server on stream ${streamA.id}`)
  19. await streamA.sendTotal(100)
  20. console.log('sent 100 units')
  21.  
  22. console.log(`sending money to server on stream ${streamB.id}`)
  23. await streamB.sendTotal(200)
  24. console.log('sent 200 units')
Add Comment
Please, Sign In to add comment